The PL/SQL Cop tool suite supports the new Trivadis PL/SQL & SQL Coding Guidelines 3.2. Download the new versions from the Download section. So, what’s new?
Numbering and Categorisation Scheme
The guidelines have been renumbered, extended, categorised by severity (blocker, critical, major, minor and info) and assigned to one or more SQALE characteristics (changeability, efficiency, maintainability, portability, reliability, reusability, security and testability).
This new categorisation allows to sort issues by severity. The most important issues will be listed first, even if you do not disable less important guidelines.
Severity and characteristics may now be used beside guideline numbers in check and skip lists (white- and blacklists).
Validator Plugins
Would you like to create your own guidelines? Or extend the existing guidelines? Then validators are your friends. A validator is basically a Java class implementing the PLSQLCopValidator interface. Validators may be used in the command-line utility, in SonarQube and in the SQL Developer extension.
A complete example is provided with source code as Maven project. This example extends the default validator by 15 additional guidelines to check naming conventions according chapter 2.2 of the Trivadis PL/SQL & SQL Coding Guidelines 3.2. The following screenshot shows the violation of a custom guideline (G-9013: Exceptions should start with ‘e’) within SonarQube.
PL/SQL Editor for Eclipse
The editor is mainly provided to understand the PL/SQL model better. The full model is available as PLSQL.ecore file, which may be explored best within the Eclipse IDE. Understanding the PL/SQL model is important if you plan to develop your own validators.
Use the plsqleditor.zip file in the eclipse folder to install the PL/SQL editor in Eclipse. The editor supports beside an outline view, syntax colouring, bracket matching, code formatting and error integration into the Eclipse workbench.