ZPA 4.3.0
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 thatEXECUTE IMMEDIATE,OPEN … FORandDBMS_SQL.PARSEbuild 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 TABLEandCREATE SYNONYMstatements 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_CCFLAGSof the project, the target database version, or both, ZPA evaluates$IFconditions as Oracle does and analyzes only the code that is compiled. See Conditional compilation. -
New rules, all active by default:
Rule Needs metadata FunctionWithoutReturn: functions should not reach their end without returning a value no ParameterInDynamicSql: parameters should not be concatenated into dynamic SQL no OuterJoinDiscardedByCondition: conditions should not discard the rows an outer join adds no ColumnHidesPlSqlName: columns should not shadow parameters or variables in SQL conditions the column must be known, from metadata or a CREATE TABLEof the sourcesImplicitColumnConversion: character columns should not be compared with numbers or dates column types, from metadata or a CREATE TABLEof the sourcesNotInWithNull: NOT INshould not be used with values that may be nullonly for subqueries; lists are checked without it NullTestOnNotNullColumn: IS NULLconditions should not test columns that can never be nullyes ColumnIntoSmallerVariable: columns should not be read into variables smaller than the column yes -
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-resolvecomment 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,
WITHquery names andFOR UPDATE OFqualifiers. 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.ITEMare typed. ZPA Forms Extractor writes this format by default.
Before you upgrade
- SonarQube 26.7 or newer is required. ZPA 4.2.x supported 26.2.
- Expect issues to change, even with the same quality profile:
- The eight new rules are active by default in the built-in profile.
- UnusedVariable, UnusedParameter, UnusedCursor, VariableHiding, UnhandledUserDefinedException, DeterministicFunction, FunctionShouldBeDeterministic, ColumnsShouldHaveTableName, VariableInCount, InsertWithoutColumns and SelectAllColumns now use the new resolution. They see declarations in other files, so some issues appear and others disappear.
- ColumnsShouldHaveTableName now checks queries with ANSI joins, except
the columns of
USINGandNATURAL JOIN, which Oracle doesn't let you qualify. - SequenceNextvalInConditionalResult now checks standalone SQL statements, not only SQL inside PL/SQL.
- NotASelectedExpression now reports an
ORDER BYitem of aSELECT DISTINCTthat is only part of a selected expression, which raises ORA-01791. - A file that starts with a UTF-8 byte-order mark no longer fails to parse.
- Conditional compilation: if your code uses
$IF, setsonar.zpa.ccflags,sonar.zpa.databaseVersion, or both. Without them, ZPA doesn't evaluate the conditions, and the rules hold back on the names that conditional text can change.
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:childrenis read-only,fromIndexandtoIndexare 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 ofSemanticAstNode). 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.
@Ruleaccepts acategory, andPlSqlCheckVerifierruns a check through the scanner, with settings.
For detailed release notes, please visit the full changelog.