sonarqubesonarqube-5.0

SonarQube: building new PL/SQL Plugin


I am currently developing a new PL/SQL plugin (language: "plsql", key: "plsql-cop") for SonarQube (using sonarqube-5.0.1), my PL/SQL "checker" is an external java program which is analyzing the PL/SQL code and creates an XML report with all the found recommendations. I started with the recommended "sonar-reference-plugin" from GitHub to do this. To test my plugin I use SonarQube on localhost in a web browser.

The rules are implemented by implementing "RulesDefinition"; this part is easy to implement, works fine and I can see all my PL/SQL rules in my local running SonarQube in the tab "Rules".

The profile is now harder to implement. So I imported my XML profile manually via "Restore Profile" button into the SonarQube web app on the tab "Quality Profiles" successfully (no errors). But I cannot see my profile with my rules mapped. In fact I cannot see my profile definition at all on the tab "Quality Profiles" anywhere. But when I install the sonar-plsql-plugin-2.7, I can see my Profile with my mapped rules and of cause the "Sonar way" definition.

Now here are my questions:

  1. Why do I have to install the SonarQube PL/SQL plugin to see the section "PL/SQL Profiles" on the "Quality Profiles" tab?
  2. How can I make my own "PL/SQL Profile" section on the "Quality Profiles" tab?
  3. When I try to analyze some PL/SQL project, the process is stop with the follwoing error messages "ERROR: Error during Sonar runner execution ERROR: Unable to execute Sonar ERROR: Caused by: No license for plsql". Can I not create my own plugin for SonarCube for the language "plsql"?
  4. How can I analyze PL/SQL with my own plugin without getting the error message above and still see my profile in SonarCube?

Any help is highly appreciated! I would like to continue with my own SonarQube PL/SQL plugin.


Solution

    1. You are not allowed to install the commercial PL/SQL plugin without a license. You also are not allowed to alter it. So, you should either obtain a valid license, or uninstall it from your SonarQube server.
    2. See how an open source language plugin such as PHP does it: PHPProfile.java
    3. See point 1
    4. See point 1

    Here are a few considerations to take into account:

    1. If you want to be able to use your plugin without the SonarQube PL/SQL plugin installed, you need to declare a new SonarQube language in your plugin: See Php.java
    2. If you want to be able to use your plugin both without and side-by-side with the SonarQube PL/SQL plugin (i.e. run both on your project), you will need to use a different language name than plsql - else the license validation from the official plugin will kick in [that is - only when it is installed of course].
    3. If you want to make your plugin a pure addition to SonarQube PL/SQL plugin (i.e. you must have it installed and have a valid license for it) - then you do not need to declare your own SonarQube language: simply create a new rule profile using the existing plsql language key.