Skip to content

Releases: integrated-application-development/sonar-delphi

1.10.0

01 Oct 02:22
Compare
Choose a tag to compare

Added

  • FullyQualifiedImport analysis rule, which flags non-fully qualified imports.
  • API: UnitImportNameDeclaration::isAlias method.

Changed

  • Non-trivial inherited expressions are excluded in RedundantParentheses.

Fixed

  • False positives around const array literals in RedundantParentheses.

1.9.0

03 Sep 06:19
Compare
Choose a tag to compare

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 in VariableInitialization.

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

02 Aug 02:39
Compare
Choose a tag to compare

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 in UnusedProperty.

Fixed

  • Overly permissive parsing rules around string and file types.
  • Quick fixes removing comments and compiler directives in RedundantInherited.
  • False positives around message handler methods in RedundantInherited.
  • False positives when parameter names were mismatched to the inherited method in RedundantInherited and InheritedMethodWithNoCode.
  • API: ArrayConstructorNode::getImage returned an incorrect image containing [ as an element.

1.7.0

02 Jul 00:36
Compare
Choose a tag to compare

Added

  • RedundantInherited analysis rule, which flags redundant inherited statements that can be safely removed.

Changed

  • Include "found" and "expected" values for issue messages in LowercaseKeyword.
  • Exclude J and K by default in ShortIdentifier.
  • 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

31 May 04:10
Compare
Choose a tag to compare

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 and goto statements.
  • Improve handling for dereferenced types starting with E and I in PointerName.
  • 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

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

  • 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, 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.