Releases: integrated-application-development/sonar-delphi
Releases · integrated-application-development/sonar-delphi
1.6.0
Added
- "Move to implementation section" quick fix for
ImportSpecificity. - "Remove unused import" quick fix for
UnusedImport. - API:
UsesClauseNode::getImportsmethod. - API:
InterfaceSectionNode::getUsesClausemethod. - API:
ImplementationSectionNode::getUsesClausemethod. - API:
LabelNameDeclarationsymbol declaration type. - API:
DelphiScope::getLabelDeclarationsmethod. - API:
LabelDeclarationNodenode type. - API:
LabelStatementNode::getNameReferencemethod. - API:
LabelStatementNode::getStatementmethod. - API:
GotoStatementNode::getNameReferencemethod.
Changed
- Improve semantic analysis around
labelandgotostatements. - Improve handling for dereferenced types starting with
EandIinPointerName. - 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
programheader. - 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
winapicalling 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::getExceptBlockmethod. - API:
WhileStatementNode::getGuardExpressionmethod. - API:
WhileStatementNode::getStatementmethod. - API:
DelphiTokenType.WINAPItoken type. - API:
DelphiIssueBuildertype, which is returned byDelphiCheckContext::newIssue. - API:
QuickFixtype, which is accepted byDelphiIssueBuilder::withQuickFixes. - API:
QuickFixEdittype, which is accepted byQuickFix::addEdits.
Deprecated
- API:
TryStatementNode::getExpectBlockmethod, usegetExceptBlockinstead.
Fixed
- False positive
FormatStringValidissues on strings containing uppercase format specifiers. - Exception when parsing fully qualified attribute references.
DuplicatedDeclarationExceptionerrors caused by some local scopes being modeled incorrectly.- Name resolution issues around
if,else,for, andwithconstructs when the body contains a single statement.
1.4.0
Added
- Support for multiline string literals within compiler directives.
- Support for the
TEXTBLOCKdirective. - Support for named arguments.
- Support for
assemblyattributes. - API:
CompilerDirectiveParsercan now return a newTextBlockDirectivetype. - API:
CheckVerifier::withCompilerVersionmethod. - API:
CheckVerifier::withToolchainmethod. - API:
DelphiTokenType.ARGUMENTtoken type. - API:
DelphiTokenType.ASSEMBLYtoken type. - API:
ArgumentNodenode type. - API:
ArgumentListNode::getArgumentNodesmethod. - API:
AttributeNode::isAssemblymethod.
Changed
NativeIntandNativeUIntare now treated as weak aliases in Delphi 12+.- The length of open arrays is now modeled as
NativeIntin Delphi 12+. - Performance improvements.
Deprecated
- API:
ArgumentListNode::getArgumentsmethod, usegetArgumentNodesinstead.
Fixed
- Type resolution inaccuracies around subtract expressions.
- Name resolution did not occur for the magic
WidthandDecimalsarguments. (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::isMultilinemethod. - API:
TextLiteralNode::getValuemethod, which returns the effective contents of a text literal.
Changed
TextLiteralNode::getImagenow returns the text literal exactly as it appears in source code.TextLiteralNode::getImageWithoutQuotesnow simply calls the newgetValuemethod.
Deprecated
TextLiteralNode::getImageWithoutQuotes, usegetValueinstead.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
LLVMsymbol, which is defined on LLVM-based toolchains from Delphi 12 onward. - Support for the
IOSSIMULATORsymbol, which is defined on theDCCIOSSIMARM64toolchain. FormDfmanalysis rule, which flags VCL forms/frames that lack a.dfmresource.FormFmxanalysis rule, which flags FireMonkey forms/frames that lack a.fmxresource.FormatArgumentCountanalysis rule, which flagsFormatcalls where the number of format arguments does not match the number of format specifiers.FormatArgumentTypeanalysis rule, which flagsFormatarguments with types that are incompatible with their corresponding format specifiers.FormatStringValidanalysis rule, which flagsFormatcalls with invalid format strings.- API:
CompilerDirectiveParsernow returns a newResourceDirectivetype when parsing resource directives.
Changed
- Alternative casings
WritelnandReadlnare now allowed inMixedNames. - Improve clarity of the rule description for
EmptyRoutine.
Fixed
- Parsing errors on
.dprfiles 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
Copyintrinsic inferred an incorrect return type forPChar,PAnsiChar, and variants. - The
Concatintrinsic inferred an incorrect return type for single-character string literals. - The
ReadLnintrinsic was missing the standard input overload. - Ideographic space (U+3000) was erroneously accepted as a valid identifier character.
- Duplicate imports in a
requiresclause 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).
ConsecutiveVarSectionanalysis rule, which flags consecutivevarsections that can be merged.ConsecutiveConstSectionanalysis rule, which flags consecutiveconstsections that can be merged.ConsecutiveTypeSectionanalysis rule, which flags consecutivetypesections that can be merged.ConsecutiveVisibilitySectionanalysis rule, which flags consecutive visibility sections that can be merged.excludeApirule 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::isThreadVarSectionmethod. - API:
ConstSectionNode::isResourceStringSectionmethod. - API:
AttributeListNode::getAttributeTypesmethod. - API:
RoutineNameDeclaration::getAttributeTypesmethod. - API:
PropertyNameDeclaration::getAttributeTypesmethod.
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:
TypeSectionNodenow implementsVisibility. - API:
TypeDeclarationNodenow implementsVisibility.
Fixed
- The
sonar.sourceEncodingoption 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.suffixesproperty to specify the file extensions that should be analyzed.sonar.delphi.exclusionsproperty to specify file path patterns to exclude from analysis of Delphi files.sonar.delphi.test.attributeproperty to specify an attribute that will cause annotated types to be treated as test code.- Support for the
DCCOSXARM64toolchain. - Support for the
DCCIOSSIMARM64toolchain. - Support for attributes in semantic analysis.
- Support for identifiers prefixed with 2 ampersands (
&&). OleVariantoverloads forVarArrayRedimandVarClearintrinsics.InlineAssemblyanalysis rule, which flags inline assembly usage.DigitSeparatoranalysis rule, which flags numeric literals that should use digit separators to improve readability.DigitGroupinganalysis rule, which flags numeric literals that use non-standard digit groupings.AddressOfCharacterDataanalysis rule, which flags attempts to manually get the address of the first character in a string.NonLinearCastanalysis rule, which flags unsafe object and pointer casts.IndexLastListElementanalysis rule, which flags places whereTList.Lastshould be used instead of manually indexing into the list.
Changed
- Rename all rule keys. (For example,
ClassNameRuleis nowClassName) - Rewrite all rule descriptions.
- Rename plugin key from
delphitocommunitydelphi. - Rename language key from
delphtodelphi. - Rename repository key from
delphtocommunity-delphi. - Rename repository from
DelphitoCommunity Delphi. - Rename
sonar.delphi.bds.pathproperty tosonar.delphi.installationPath. - Rename
sonar.delphi.compiler.toolchainproperty tosonar.delphi.toolchain. - Rename
sonar.delphi.compiler.versionproperty tosonar.delphi.compilerVersion.' - Rename
sonar.delphi.sources.searchPathproperty tosonar.delphi.searchPath.' - Rename
sonar.delphi.testSuiteTypeproperty 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
Attributesuffix inAttributeName. - Allow the
Attributesuffix 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
AnsiStringtypes with specified code pages. - Improve type modeling around type aliases.
Removed
XPathTemplateRuleanalysis rule template.MemoryManagementRuleanalysis rule.EmptyTypeSectionanalysis rule.sonar.delphi.coverage.toolproperty.
(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
Inoperator overloads. - Parsing errors around anonymous methods in array constructor expressions.
Selfwas not consistently shadowed by method parameters.- Incorrect token range calculation for binary expression nodes.
- Units referenced via
DCCReferencetags were not indexed in the symbol table. - NPE on empty argument lists in
TrailingCommaArgumentList. addis no longer colorized as a keyword in the SonarQube web interface.removeis no longer colorized as a keyword in the SonarQube web interface.variantis 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.