Skip to content

Releases: integrated-application-development/sonar-delphi

1.5.0

02 May 03:44
Compare
Choose a tag to compare

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 by DelphiCheckContext::newIssue.
  • API: QuickFix type, which is accepted by DelphiIssueBuilder::withQuickFixes.
  • API: QuickFixEdit type, which is accepted by QuickFix::addEdits.

Deprecated

  • API: TryStatementNode::getExpectBlock method, use getExceptBlock 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, and with constructs when the body contains a single statement.

1.4.0

02 Apr 02:32
Compare
Choose a tag to compare

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 new TextBlockDirective 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 and NativeUInt 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, use getArgumentNodes instead.

Fixed

  • Type resolution inaccuracies around subtract expressions.
  • Name resolution did not occur for the magic Width and Decimals arguments. (See: System.Write)
  • The wrong inherited method could be found in InheritedMethodWithNoCode, causing false negatives.
  • Exception when scanning UNC paths.

1.3.0

01 Mar 04:55
Compare
Choose a tag to compare

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 new getValue method.

Deprecated

  • TextLiteralNode::getImageWithoutQuotes, use getValue instead.
  • DelphiTokenType.AMPERSAND, as & is now lexed directly into numeric literals and identifiers.

Fixed

  • Static char arrays weren't accepted for '%s' in FormatArgumentType.
  • Imaginary tokens could be erroneously matched by the lexer in valid source code.

1.2.0

02 Feb 03:34
Compare
Choose a tag to compare

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 the DCCIOSSIMARM64 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 flags Format calls where the number of format arguments does not match the number of format specifiers.
  • FormatArgumentType analysis rule, which flags Format arguments with types that are incompatible with their corresponding format specifiers.
  • FormatStringValid analysis rule, which flags Format calls with invalid format strings.
  • API: CompilerDirectiveParser now returns a new ResourceDirective type when parsing resource directives.

Changed

  • Alternative casings Writeln and Readln are now allowed in MixedNames.
  • Improve clarity of the rule description for EmptyRoutine.

Fixed

  • Parsing errors on .dpr files without a top-level begin.
  • 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 for PChar, 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

02 Jan 08:05
Compare
Choose a tag to compare

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 consecutive var sections that can be merged.
  • ConsecutiveConstSection analysis rule, which flags consecutive const sections that can be merged.
  • ConsecutiveTypeSection analysis rule, which flags consecutive type sections that can be merged.
  • ConsecutiveVisibilitySection analysis rule, which flags consecutive visibility sections that can be merged.
  • excludeApi rule property to most of the Unused* rules:
    • Available for UnusedConstant, UnusedField, UnusedGlobalVariable, UnusedProperty, UnusedRoutine, and UnusedType.
    • Excludes public API (declared with public visibility in the interface section).
  • 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, and PlatformDependentCast.
  • 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 implements Visibility.
  • API: TypeDeclarationNode now implements Visibility.

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

13 Nov 22:36
Compare
Choose a tag to compare

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 for VarArrayRedim and VarClear 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 where TList.Last should be used instead of manually indexing into the list.

Changed

  • Rename all rule keys. (For example, ClassNameRule is now ClassName)
  • Rewrite all rule descriptions.
  • Rename plugin key from delphi to communitydelphi.
  • Rename language key from delph to delphi.
  • Rename repository key from delph to community-delphi.
  • Rename repository from Delphi to Community Delphi.
  • Rename sonar.delphi.bds.path property to sonar.delphi.installationPath.
  • Rename sonar.delphi.compiler.toolchain property to sonar.delphi.toolchain.
  • Rename sonar.delphi.compiler.version property to sonar.delphi.compilerVersion.'
  • Rename sonar.delphi.sources.searchPath property to sonar.delphi.searchPath.'
  • Rename sonar.delphi.testSuiteType property to sonar.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 in AttributeName.
  • Allow the Attribute suffix to be omitted for attribute references in MixedNames.
  • 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.