Releases: integrated-application-development/sonar-delphi
Releases · integrated-application-development/sonar-delphi
1.10.0
Added
FullyQualifiedImport
analysis rule, which flags non-fully qualified imports.- API:
UnitImportNameDeclaration::isAlias
method.
Changed
- Non-trivial
inherited
expressions are excluded inRedundantParentheses
.
Fixed
- False positives around const array literals in
RedundantParentheses
.
1.9.0
Added
- API:
CaseItemStatementNode::getExpressions
method.
Changed
- Improve type inference around unsigned integer literals.
- Improve type inference around array constructors containing integer literals.
- Improve type inference around real expressions.
- Parentheses enclosing a primary expression are considered redundant in
RedundantParentheses
. out
parameters are treated as uninitialized at the start of a routine inVariableInitialization
.
Fixed
- Name resolution errors around alias ancestor types.
- Parsing errors around partial
asm
blocks blocks in conditional branches. - False positives around case items with multiple values in
CaseStatementSize
.
1.8.0
Added
- "Correct to (correct case)" quick fix for
LowercaseKeyword
. - API:
PropertyNameDeclaration::getImplementedTypes
method. - API:
PropertyNode::getDefaultSpecifier
method. - API:
PropertyNode::getImplementsSpecifier
method. - API:
PropertyNode::getIndexSpecifier
method. - API:
PropertyNode::getStoredSpecifier
method. - API:
PropertyDefaultSpecifierNode
node type. - API:
PropertyImplementsSpecifierNode
node type. - API:
PropertyIndexSpecifierNode
node type. - API:
PropertyStoredSpecifierNode
node type.
Changed
- Include the global library path in unit import resolution.
- Improve AST modeling around property specifiers.
- Improve semantic analysis around property specifiers.
- Exclude properties with
implements
specifiers inUnusedProperty
.
Fixed
- Overly permissive parsing rules around
string
andfile
types. - Quick fixes removing comments and compiler directives in
RedundantInherited
. - False positives around
message
handler methods inRedundantInherited
. - False positives when parameter names were mismatched to the inherited method in
RedundantInherited
andInheritedMethodWithNoCode
. - API:
ArrayConstructorNode::getImage
returned an incorrect image containing[
as an element.
1.7.0
Added
RedundantInherited
analysis rule, which flags redundantinherited
statements that can be safely removed.
Changed
- Include "found" and "expected" values for issue messages in
LowercaseKeyword
. - Exclude
J
andK
by default inShortIdentifier
. - Improve compiler directive parsing in cases where the directive name is not followed by whitespace.
Fixed
- The
result
attribute in NUnit test reports was not being treated as case-insensitive. - Scan failures on nested compiler directives.
1.6.0
Added
- "Move to implementation section" quick fix for
ImportSpecificity
. - "Remove unused import" quick fix for
UnusedImport
. - API:
UsesClauseNode::getImports
method. - API:
InterfaceSectionNode::getUsesClause
method. - API:
ImplementationSectionNode::getUsesClause
method. - API:
LabelNameDeclaration
symbol declaration type. - API:
DelphiScope::getLabelDeclarations
method. - API:
LabelDeclarationNode
node type. - API:
LabelStatementNode::getNameReference
method. - API:
LabelStatementNode::getStatement
method. - API:
GotoStatementNode::getNameReference
method.
Changed
- Improve semantic analysis around
label
andgoto
statements. - Improve handling for dereferenced types starting with
E
andI
inPointerName
. - Improve handling for dereferenced types that don't comply with naming conventions in
PointerName
.
Fixed
- File pointer errors when an issue is raised on the first line of a file with a byte order mark.
- Symbol table construction errors for program files omitting the
program
header. - Parsing errors on parenthesised anonymous methods.
- Parsing errors on identifiers named
Label
, which was allowed in Delphi.NET. - Scan failures on invalid paths in dproj files.
- Incorrect ordering of edits in the "Separate grouped parameters" quick fix for
GroupedParameterDeclaration
. - SonarLint registration of rules that don't support execution in a SonarLint context.
1.5.0
Added
- Support for the
winapi
calling convention. - Support for quick fixes.
- "Remove the superflous semicolon" quick fix for
SuperfluousSemicolon
. - "Correct to (correct case)" quick fix for
MixedNames
. - "Remove redundant parentheses" quick fix for
RedundantParentheses
. - "Convert to initialization section" quick fix for
LegacyInitializationSection
. - "Replace Pascal-style result with Result" quick fix for
PascalStyleResult
. - "Replace with TList.Last" quick fix for
IndexLastListElement
. - "Remove empty argument list" quick fix for
EmptyArgumentList
. - "Remove redundant assignment check" quick fix for
AssignedAndFree
. - "Separate grouped parameters" quick fix for
GroupedParameterDeclaration
. - "Remove (n) unused formatting arguments" quick fix for
FormatArgumentCount
. - "Use string value directly" quick fix for
FormatArgumentCount
. - API:
TryStatementNode::getExceptBlock
method. - API:
WhileStatementNode::getGuardExpression
method. - API:
WhileStatementNode::getStatement
method. - API:
DelphiTokenType.WINAPI
token type. - API:
DelphiIssueBuilder
type, which is returned byDelphiCheckContext::newIssue
. - API:
QuickFix
type, which is accepted byDelphiIssueBuilder::withQuickFixes
. - API:
QuickFixEdit
type, which is accepted byQuickFix::addEdits
.
Deprecated
- API:
TryStatementNode::getExpectBlock
method, usegetExceptBlock
instead.
Fixed
- False positive
FormatStringValid
issues on strings containing uppercase format specifiers. - Exception when parsing fully qualified attribute references.
DuplicatedDeclarationException
errors caused by some local scopes being modeled incorrectly.- Name resolution issues around
if
,else
,for
, andwith
constructs when the body contains a single statement.
1.4.0
Added
- Support for multiline string literals within compiler directives.
- Support for the
TEXTBLOCK
directive. - Support for named arguments.
- Support for
assembly
attributes. - API:
CompilerDirectiveParser
can now return a newTextBlockDirective
type. - API:
CheckVerifier::withCompilerVersion
method. - API:
CheckVerifier::withToolchain
method. - API:
DelphiTokenType.ARGUMENT
token type. - API:
DelphiTokenType.ASSEMBLY
token type. - API:
ArgumentNode
node type. - API:
ArgumentListNode::getArgumentNodes
method. - API:
AttributeNode::isAssembly
method.
Changed
NativeInt
andNativeUInt
are now treated as weak aliases in Delphi 12+.- The length of open arrays is now modeled as
NativeInt
in Delphi 12+. - Performance improvements.
Deprecated
- API:
ArgumentListNode::getArguments
method, usegetArgumentNodes
instead.
Fixed
- Type resolution inaccuracies around subtract expressions.
- Name resolution did not occur for the magic
Width
andDecimals
arguments. (See: System.Write) - The wrong inherited method could be found in
InheritedMethodWithNoCode
, causing false negatives. - Exception when scanning UNC paths.
1.3.0
Added
- Support for multiline string literals.
- Support for numeric literals prefixed by ampersands.
- Support for identifiers prefixed by more than 2 ampersands.
- API:
TextLiteralNode::isMultiline
method. - API:
TextLiteralNode::getValue
method, which returns the effective contents of a text literal.
Changed
TextLiteralNode::getImage
now returns the text literal exactly as it appears in source code.TextLiteralNode::getImageWithoutQuotes
now simply calls the newgetValue
method.
Deprecated
TextLiteralNode::getImageWithoutQuotes
, usegetValue
instead.DelphiTokenType.AMPERSAND
, as&
is now lexed directly into numeric literals and identifiers.
Fixed
- Static char arrays weren't accepted for
'%s'
inFormatArgumentType
. - Imaginary tokens could be erroneously matched by the lexer in valid source code.
1.2.0
Added
- Support for on-demand plugin downloading, which is being introduced in SonarQube 10.4.
- Support for the
LLVM
symbol, which is defined on LLVM-based toolchains from Delphi 12 onward. - Support for the
IOSSIMULATOR
symbol, which is defined on theDCCIOSSIMARM64
toolchain. FormDfm
analysis rule, which flags VCL forms/frames that lack a.dfm
resource.FormFmx
analysis rule, which flags FireMonkey forms/frames that lack a.fmx
resource.FormatArgumentCount
analysis rule, which flagsFormat
calls where the number of format arguments does not match the number of format specifiers.FormatArgumentType
analysis rule, which flagsFormat
arguments with types that are incompatible with their corresponding format specifiers.FormatStringValid
analysis rule, which flagsFormat
calls with invalid format strings.- API:
CompilerDirectiveParser
now returns a newResourceDirective
type when parsing resource directives.
Changed
- Alternative casings
Writeln
andReadln
are now allowed inMixedNames
. - Improve clarity of the rule description for
EmptyRoutine
.
Fixed
- Parsing errors on
.dpr
files without a top-levelbegin
. - Symbol table errors on declarations that shared a name with a unit import.
- Symbol table executor failures on include directives that include multiple symbol declarations or references.
- The
Copy
intrinsic inferred an incorrect return type forPChar
,PAnsiChar
, and variants. - The
Concat
intrinsic inferred an incorrect return type for single-character string literals. - The
ReadLn
intrinsic was missing the standard input overload. - Ideographic space (U+3000) was erroneously accepted as a valid identifier character.
- Duplicate imports in a
requires
clause now log a warning instead of throwing an exception.
1.1.0
Added
- Support for unicode characters in identifiers.
- Support for the NUnit 2.0 test results format (in addition to existing 3.0 support).
ConsecutiveVarSection
analysis rule, which flags consecutivevar
sections that can be merged.ConsecutiveConstSection
analysis rule, which flags consecutiveconst
sections that can be merged.ConsecutiveTypeSection
analysis rule, which flags consecutivetype
sections that can be merged.ConsecutiveVisibilitySection
analysis rule, which flags consecutive visibility sections that can be merged.excludeApi
rule property to most of theUnused*
rules:- Available for
UnusedConstant
,UnusedField
,UnusedGlobalVariable
,UnusedProperty
,UnusedRoutine
, andUnusedType
. - Excludes public API (declared with public visibility in the interface section).
- Available for
- API:
VarSectionNode::isThreadVarSection
method. - API:
ConstSectionNode::isResourceStringSection
method. - API:
AttributeListNode::getAttributeTypes
method. - API:
RoutineNameDeclaration::getAttributeTypes
method. - API:
PropertyNameDeclaration::getAttributeTypes
method.
Changed
- Improve type resolution on binary and unary expressions.
- Improve type comparisons between signed and unsigned integer types.
- Improve type comparisons between text types.
- Improve type conversions from character pointers to strings.
- Exclude routines annotated with attributes in
UnusedRoutine
. - Exclude properties annotated with attributes in
UnusedProperty
. - Exclude fields annotated with attributes in
UnusedField
. - Improve type modeling around integer subranges.
- Issues raised on a hard cast expression now span the entire expression in
UnicodeToAnsiCast
,CharacterToCharacterPointerCast
,NonLinearCast
,RedundantCast
, andPlatformDependentCast
. - Parsing errors now consistently surface the file and line where they occurred.
- Parsing errors now consistently skip the offending unit instead of crashing the scan.
- API:
TypeSectionNode
now implementsVisibility
. - API:
TypeDeclarationNode
now implementsVisibility
.
Fixed
- The
sonar.sourceEncoding
option was used blindly in all cases, even when the correct encoding could be detected. - Test sources were erroneously excluded from analysis.
- Key information was missing from "ambiguous declarations" warnings.
- Stack overflow on class reference types that reference their containing type.
- Scan failures on redundant unit aliases in .dproj files.
- Incorrect file position calculation for multiline compiler directives.
- Incorrect detection of method calls as hard casts in
CastAndFree
. - Name resolution failures around helpers extending weak alias types.
- Various intrinsic routine signatures had incorrect return types.
- Various intrinsic routine signatures had incorrect or overly-restrictive parameter types.