11.6 CODESCAN
Identifies issues with the code using the Trivadis Coding Guidelines, which is available on GitHub.
Syntax
codescan { -path dir | -format {json|text} | -ignore ruleNo | -output file | -settings file }where
- -pathchecks SQL, PLS and PLB files in the directory for SQL Best Practice violations and generates a report of the issues found.
- -formatformats the output as structured JSON. For example:- [ {"file": "/private/tmp/tst.sql", "warnings": [ {line:35, pos:15, ruleNo:"G-1050", msg:"Avoid using literals in your code" },...]... ].
- -outputsaves the report in a new file.
- -ignoreskips specified rule checks.
- -settingsimports CODESCAN settings from the JSON file. Currently, only the ignore attribute is supported, example,- {"ignored":["G-1050", "G-4010"]}.
Set Codescan
Controls warning messages that are triggered for SQLcl command line code quality issues.
Syntax
set codescan {ON | OFF}where ON turns on warnings for SQL and  PL/SQL best practice violations.
        The default is OFF.
                  
Example
SQL>set codescan on
SQL>BEGIN
    BEGIN
        null; 
    END;
 END;
/
SQL best practice warning (1,7): G-1010: Try to label your sub blocks 
PL/SQL procedure successfully completed.