From time to time, I receive requests from SonarSource customers that want to use ZPA on a commercial edition of SonarQube and hit some issue (e.g. #103 and #131). Currently, it's necessary to choose between SonarPLSQL (the SonarSource's plugin) and ZPA setting the properties sonar.plsql.file.suffixes (for SonarPLSQL) or sonar.zpa.file.suffixes (for ZPA) accordingly. It's not possible to analyze the same file with both plugins at the same time.
This happens because ZPA declares a language called "plsqlopen", register the same file types as the SonarPLSQL plugin and always save metrics for the analyzed files.
I always believed that SonarQube didn't allow that two plugins analyze the same file but according to Pierre-Yves Nicolas (a SonarSource employee) it should be possible to support this scenario:
You can create your own plugin and deploy it on a server which already has sonar-plsql-plugin.jar. However, it should not declare the plsql language and the same file extensions as sonar-plsql-plugin.jar. It can still analyze the plsql files and raise issues on them. There are some open source community plugins which do that for java (example).
As can be seen in the given example, the sonar-checkstyle plugin can analyze the same Java files analyzed by the SonarJava analyzer because it's reading the files indexed by SonarJava:
Considering this, to offer "proper support" for commercial editions of SonarQube, i.e. execute ZPA and SonarPLSQL side-by-side in the same file, some things come to my mind:
PlSqlSquiSensor should read files detected as "plsql" language (currently it looks for PlSql.KEY, which is plsqlopen)
PlSqlAstScanner cannot save highlighting data, symbol table and metrics when detected language is plsql (these will be handled by the SonarPLSQL plugin)
PlSqlRuleRepository create a repository in the plsqlopen language, it needs to be changed to plsql language
Get a license of SonarQube Developer Edition to test the plugin ($150 per year).
To be honest, the last point is an impeditive for me and I don't plan to move forward with this issue by myself.
From time to time, I receive requests from SonarSource customers that want to use ZPA on a commercial edition of SonarQube and hit some issue (e.g. #103 and #131). Currently, it's necessary to choose between SonarPLSQL (the SonarSource's plugin) and ZPA setting the properties
sonar.plsql.file.suffixes
(for SonarPLSQL) orsonar.zpa.file.suffixes
(for ZPA) accordingly. It's not possible to analyze the same file with both plugins at the same time.This happens because ZPA declares a language called "plsqlopen", register the same file types as the SonarPLSQL plugin and always save metrics for the analyzed files.
I always believed that SonarQube didn't allow that two plugins analyze the same file but according to Pierre-Yves Nicolas (a SonarSource employee) it should be possible to support this scenario:
As can be seen in the given example, the sonar-checkstyle plugin can analyze the same Java files analyzed by the SonarJava analyzer because it's reading the files indexed by SonarJava:
https://github.com/checkstyle/sonar-checkstyle/blob/69ca51477e6abfb6be295ff5a54d77867a4ce340/src/main/java/org/sonar/plugins/checkstyle/CheckstyleSensor.java#L35-L38
Considering this, to offer "proper support" for commercial editions of SonarQube, i.e. execute ZPA and SonarPLSQL side-by-side in the same file, some things come to my mind:
PlSql.KEY
, which isplsqlopen
)https://github.com/felipebz/zpa/blob/432c08ff6fccbfe818a0465913b1a3c50bf29c0c/sonar-plsql-open-plugin/src/main/kotlin/org/sonar/plsqlopen/PlSqlSquidSensor.kt#L57
PlSqlAstScanner cannot save highlighting data, symbol table and metrics when detected language is
plsql
(these will be handled by the SonarPLSQL plugin)PlSqlRuleRepository create a repository in the
plsqlopen
language, it needs to be changed toplsql
languageGet a license of SonarQube Developer Edition to test the plugin ($150 per year).
To be honest, the last point is an impeditive for me and I don't plan to move forward with this issue by myself.