Releases: integrated-application-development/sonar-delphi
Releases · integrated-application-development/sonar-delphi
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
- 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.
1.0.0
Added
- Custom rules plugin API:
- Rule metadata for the new Clean Code Taxonomy.
sonar.delphi.file.suffixes
property to specify the file extensions that should be analyzed.sonar.delphi.exclusions
property to specify file path patterns to exclude from analysis of Delphi files.sonar.delphi.test.attribute
property to specify an attribute that will cause annotated types to be treated as test code.- Support for the
DCCOSXARM64
toolchain. - Support for the
DCCIOSSIMARM64
toolchain. - Support for attributes in semantic analysis.
- Support for identifiers prefixed with 2 ampersands (
&&
). OleVariant
overloads forVarArrayRedim
andVarClear
intrinsics.InlineAssembly
analysis rule, which flags inline assembly usage.DigitSeparator
analysis rule, which flags numeric literals that should use digit separators to improve readability.DigitGrouping
analysis rule, which flags numeric literals that use non-standard digit groupings.AddressOfCharacterData
analysis rule, which flags attempts to manually get the address of the first character in a string.NonLinearCast
analysis rule, which flags unsafe object and pointer casts.IndexLastListElement
analysis rule, which flags places whereTList.Last
should be used instead of manually indexing into the list.
Changed
- Rename all rule keys. (For example,
ClassNameRule
is nowClassName
) - Rewrite all rule descriptions.
- Rename plugin key from
delphi
tocommunitydelphi
. - Rename language key from
delph
todelphi
. - Rename repository key from
delph
tocommunity-delphi
. - Rename repository from
Delphi
toCommunity Delphi
. - Rename
sonar.delphi.bds.path
property tosonar.delphi.installationPath
. - Rename
sonar.delphi.compiler.toolchain
property tosonar.delphi.toolchain
. - Rename
sonar.delphi.compiler.version
property tosonar.delphi.compilerVersion
.' - Rename
sonar.delphi.sources.searchPath
property tosonar.delphi.searchPath
.' - Rename
sonar.delphi.testSuiteType
property tosonar.delphi.testType
. - Clean up descriptions of all plugin properties.
- Exclude dpr and dpk files in
UnusedImport
. - Exclude dpr and dpk files in
ImportSpecificity
. - Exclude uses clauses of dpr and dpk files in
LineTooLong
. - Include routines in
UnitLevelKeywordIndentation
. - Include implicit attribute constructor calls in
ForbiddenRoutine
. - Always enforce the
Attribute
suffix inAttributeName
. - Allow the
Attribute
suffix to be omitted for attribute references inMixedNames
. - Allow the extended type name to be anywhere in the helper name (rather than requiring it at the start) in
HelperName
. - Take a fully-qualified type name for the parent type in
InheritedTypeName
, instead of a regular expression. - Improve name resolution for declarations within types.
- Improve type resolution for array accesses into variants.
- Improve type resolution around constructor calls following array accesses in primary expressions.
- Improve parsing and type modeling around
AnsiString
types with specified code pages. - Improve type modeling around type aliases.
Removed
XPathTemplateRule
analysis rule template.MemoryManagementRule
analysis rule.EmptyTypeSection
analysis rule.sonar.delphi.coverage.tool
property.
(Delphi Code Coverage is the only supported coverage tool.)
Fixed
OSX(64)
symbols weren't treated as defined on macOS.MACOS(32|64)
symbols weren't treated as defined on iOS.- Name collisions between generic and non-generic forward declarations.
- Incorrect type conversions from pointers to arrays.
- Fixed arrays were overly-eager to convert to dynamic arrays.
- Parsing errors around
In
operator overloads. - Parsing errors around anonymous methods in array constructor expressions.
Self
was not consistently shadowed by method parameters.- Incorrect token range calculation for binary expression nodes.
- Units referenced via
DCCReference
tags were not indexed in the symbol table. - NPE on empty argument lists in
TrailingCommaArgumentList
. add
is no longer colorized as a keyword in the SonarQube web interface.remove
is no longer colorized as a keyword in the SonarQube web interface.variant
is no longer colorized as a keyword in the SonarQube web interface.- Parsing errors on unusual whitespace characters.
- Parsing errors on unusual escaped character, hex integer, and binary integer literals.