Skip to main content

ZPA 4.3.0

· 5 min read
Maintainer

ZPA 4.3.0 is out! This version replaces the name resolution engine. The analysis now reads the whole project before it checks a file, so a name is resolved against the declarations of every file: package specifications and bodies in separate files, standalone subprograms, object types and their methods, synonyms and the tables the sources create. It can also read the Oracle data dictionary. When a name can't be decided, because a declaration is missing or conditional text may change it, the rules that depend on it stay silent instead of guessing.

  • SonarQube compatibility: Compatible with SonarQube Community Build 26.7 and newer (tested with 26.7 to 26.11).

  • Project-wide resolution:

    • Calls bind to the overload Oracle would choose, including overloads that differ only by the type of an argument.
    • Names are resolved through %TYPE, %ROWTYPE, records, collections, object attributes and methods, and synonyms.
    • Names inside SQL are told apart from columns, also in SELECT … INTO, cursor loops and the SQL text that EXECUTE IMMEDIATE, OPEN … FOR and DBMS_SQL.PARSE build from literals.
  • Database metadata (optional): with a connection, ZPA reads the tables, views, columns, object types, synonyms and subprogram signatures of the schemas you list, in a read-only transaction. Without one, the CREATE TABLE and CREATE SYNONYM statements of the sources play the same part. See Database metadata.

  • Compilation schema: each file can be assigned the schema it compiles in, so schema-qualified names and units created without an owner resolve as they do in the database. See Compilation schema.

  • Conditional compilation: with the PLSQL_CCFLAGS of the project, the target database version, or both, ZPA evaluates $IF conditions as Oracle does and analyzes only the code that is compiled. See Conditional compilation.

  • New rules, all active by default:

    RuleNeeds metadata
    FunctionWithoutReturn: functions should not reach their end without returning a valueno
    ParameterInDynamicSql: parameters should not be concatenated into dynamic SQLno
    OuterJoinDiscardedByCondition: conditions should not discard the rows an outer join addsno
    ColumnHidesPlSqlName: columns should not shadow parameters or variables in SQL conditionsthe column must be known, from metadata or a CREATE TABLE of the sources
    ImplicitColumnConversion: character columns should not be compared with numbers or datescolumn types, from metadata or a CREATE TABLE of the sources
    NotInWithNull: NOT IN should not be used with values that may be nullonly for subqueries; lists are checked without it
    NullTestOnNotNullColumn: IS NULL conditions should not test columns that can never be nullyes
    ColumnIntoSmallerVariable: columns should not be read into variables smaller than the columnyes
  • SonarQube:

    • Each rule declares a category, sent to SonarQube as its clean code attribute and shown on the rule pages.
    • Rule descriptions are split into "Why is this an issue?" and "How can I fix it?", and most now have examples.
    • A sonar-resolve comment accepts an issue or marks it as a false positive, with a justification. See Resolving issues from comments.
    • Symbol highlighting comes from the new resolution and now covers table aliases, table names, WITH query names and FOR UPDATE OF qualifiers. Number, date and timestamp literals are highlighted as constants.
  • Oracle Forms: the Forms metadata can state the data type of each item and parameter, so host variables such as :BLOCK.ITEM are typed. ZPA Forms Extractor writes this format by default.

Before you upgrade​

All the new analysis parameters are optional; Scanning code lists them.

For custom rule developers​

Rebuild your plugins with ZPA 4.3.0. Some also need source changes:

  • ZPA now uses FLR 2.0.0, which changes AstNode: children is read-only, fromIndex and toIndex are gone, and a nonterminal that matched no input has no token. See the FLR 2.0.0 release notes.
  • New semantic queries answer which declaration a name, call, column or field refers to, whether a declaration is used, and the type of a value. They are experimental; see the Semantic API.
  • The legacy symbol model is deprecated (symbolTable, currentScope, Symbol, Scope, SymbolTable, PlSqlType, the symbol and datatype accessors of SemanticAstNode). It still works as in 4.2.x and will be removed in ZPA 5.0.
  • The experimental project API changed without deprecation, as its opt-in level allows.
  • @Rule accepts a category, and PlSqlCheckVerifier runs a check through the scanner, with settings.

For detailed release notes, please visit the full changelog.