Skip to content

PL/SQL Cop for ZPA v7.9.0.0 (Beta)

Pre-release
Pre-release
Compare
Choose a tag to compare
@PhilippSalvisberg PhilippSalvisberg released this 31 Jul 19:10
· 25 commits to main since this release

Version 7.9.0.0 (Beta)

This is a secondary SonarQube plugin for SonarQube 7.9LTS (or newer). It requires the primary SonarQube plugin Z PL/SQL Analyzer (ZPA).

The idea is to run ZPA and PL/SQL Cop on the same SonarQube server. This is not possible in a standard setup, since a file extensions is associated with one and only one language (either "plsqlcop" or "plsqlopen"). And one language is by default managed by a single SonarQube plugin.

Trivadis recommends to use only one plugin for PL/SQL. If different projects require different plugins for the same language then dedicated SonarQube instances are recommended.

However, this plugin offers to check ZPA and PL/SQL Cop rules for the same project. Of course it is possible to configure only ZPA or only PL/SQL Cop rules for projects to ensure that the license agreement regarding the number of developers is honoured while keeping the infrastructure as simple as possible.

Responsibility of the Primary Plugin ZPA

ZPA is the primary plugin. It is responsible for the following:

  • The "PL/SQL (ZPA)" language. The internal language code is "plsqlopen"
  • The rules repositories:
    • Z PL/SQL Analyzer
    • Common PL/SQL (ZPA)
  • Configuration of file suffixes to be recognised and processed as language "plsqlopen"
  • Measures
    • Size (New Lines, Lines of Code, Lines, Statements, Functions, Files, Comment Lines, Comment (%)
    • Complexity (Cyclomatic Complexity)
    • Duplication (Duplicated Lines, Duplicated blocks)
    • Coverage (Lines to Cover, Uncovered Lines, Conditions to Cover, Uncovered Conditions)
  • Issues
    • Based on the rules in the quality profile of the ZPA repositories

Responsibility of the Secondary Plugin PL/SQL Cop

PL/SQL Cop is the secondary plugin. It is responsible for the following:

  • The rules repository "PL/SQL Cop Rules"
  • Configuration of the PL/SQL Cop License
  • Issues
    • Based on the rules in the quality profile of the "PL/SQL Cop Rules" repositories
    • The rules are checked only if at least one PL/SQL Cop rule is active. This ensures that the runtime of projects not using PL/SQL Cop is not too much affected

Limitations

  • No PL/SQL Cop CLI

    • This plugin does not call the PL/SQL Cop CLI. Therefore it is not necessary to configure the path to the CLI for the SonarQube server and the clients running SonarScanner
    • This simplifies the usage, since no special configuration on the client side is necessary. The downside is that the additional features of the CLI are missing
  • No Custom Validators

    • This plugin uses the com.trivadis.tvdcc.validators.TrivadisGuidelines3 validator
    • It is not possible to configure another validator
    • It is not possible to define custom rules
    • It might be possible that these limitations are lifted in one of the coming releases, e.g. by providing a method to build a custom SonarQube plugin the same way as we currently provide a mechanism to build custom validators.
  • PL/SQL Cop Plugin is always downloaded

    • All plugins for known file extensions are downloaded, regardless of the active rules for a project. However, the plugins are cached by the client and therefore the runtime should be affected for the first run only

Installation

Copy the downloaded sonar-plsql-cop-plugin-zpa-7.9.0.0.jar file into the extensions/plugins folder of your SonarQube installation and restart the SonarQube server. Login as admin, click on "Administration" in the main menu bar and configure the "PL/SQL Cop" section as shown below:

image

Configure file extensions

Configure the file extensions you want to analyse with ZPA and PL/SQL Cop here:

image

Configure Quality profiles

Configure one or more quality profiles to be used by the projects. Here's an example:

image

Example Analysis Result

image