Hi Louis,
Sorry it has taken me a while to get to this.
You will find below the narrative of quirks I found and comments I had as I tested your jar/plugin. I wonât make you read to the end though to get the upshot.
There are currently 3 barriers to adding this plugin to the Marketplace.
-
Youâre failing the Quality Gate on SonarCloud. When I look at your QG status graph, what I see reflects active development. So okay, maybe you failed since the release but you were fine when you released? Well, no. The timestamp of the GH tag (normalized for my time zone, I think) is 23 Aug. 8:26 a.m. Latest analysis, where your QG went red, was 23 Aug. 8:24 a.m. So 2 min before. TBH, I was looking for a way to accept that you were Passing when you released, but the timestamps wonât allow me to do that. Youâll need to release 3.0.1 anyway (more below) so youâve got another chance at this.
-
Iâve requested some changes in your PR. This part is easily handled, though. (Youâll obviously also need to make version number changes)
-
It appears that when you craft a report bundle you first write the reports to SonarQubeâs temp directory before streaming the zip out to the user. To my knowledge, this directory is not cleaned up, so with your plugin the user runs the risk of running out of disk space. There is nothing in the SQ docs about performing maintenance in this directory (because thereâs no need) and nothing in your README that I noticed. For me accumulating these files in the file system is a blocker, and even adding a notice in your README wouldnât be sufficient.
So⊠those three things must be done to enter the Marketplace. Below Iâve described some additional things you might want to handle eventually.
I find the dual nature of your jar/plugin interesting, so I tried it first standalone. A default command, java -jar sonar-cnes-report.jar
yielded this:
SonarQube URL: http://localhost:9000
SonarQube online: true
Detected SonarQube version: 7.9.0
[ERROR] The 'component' parameter is missing
Fair enough. Time to ask for help to see how to pass componentâŠ
java -jar sonar-cnes-report.jar -h
usage: java -jar cnesreport.jar [-a <arg>] [-c] [-d <arg>] [-e] [-f <arg>] [-h] [-l <arg>] [-m <arg>] [-n <arg>] [-o <arg>] [-p
<arg>] [-r <arg>] [-s <arg>] [-t <arg>] [-v] [-w] [-x <arg>]
Generate editable reports for SonarQube projects.
-a,--author <arg> Name of the report writer.
-c,--disable-conf Disable export of quality configuration used during analysis.
-d,--date <arg> Date for the report. Default: current date.
-e,--disable-spreadsheet Disable spreadsheet generation.
-f,--disable-csv <arg> Disable CSV generation
-h,--help Display this message.
-l,--language <arg> Language of the report. Values: en_US, fr_FR. Default: en_US.
-m,--disable-markdown <arg> Disable Markdown generation
-n,--template-markdown <arg> Path to the report template in markdown. Default: usage of internal template.
-o,--output <arg> Output path for exported resources.
-p,--project <arg> SonarQube key of the targeted project.
-r,--template-report <arg> Path to the report template. Default: usage of internal template.
-s,--server <arg> Complete URL of the targeted SonarQube server.
-t,--token <arg> SonarQube token of the SonarQube user who has permissions on the project.
-v,--version Display current version.
-w,--disable-report Disable report generation.
-x,--template-spreadsheet <arg> Path to the spreadsheet template. Default: usage of internal template.
Please report issues at https://github.com/lequal/sonar-cnes-report/issues
No where in there do I see a flag for passing âThe âcomponentâ parameterâ. 
A further browse of your docs yields the fact that youâre looking for a project id (-p
/--project
). It might be helpful to synch up the error message with the flag names. 
Once I passed in a project id I got my 4 reports.
LibreOffice 6.0 gave me an error on opening the .docx:
An error occurred during opening the file. This may be caused by incorrect file contents.
The error details are:
SAXException: [word/document.xml line 271]: unknown error
Proceeding with import may cause data loss or corruption, and application may become unstable or crash.
I okay-ed past that and it seemed to open fine, though.
Since this is my localhost test server, I donât generally bother to generate and include test coverage reports. I think that threw the report generator:
The metric section doesnât make a lot of sense to me:
And the Issues part of the report makes me wish for a âThe Screamâ emoji.
doesnât quite do my feelings justice.
But whatever. It seems that the report generator doesnât know how to handle hotspots (or maybe thatâs what my initial error was about):

Now, on to the SQ plugin!
Once installed, I find⊠nothing in the project homepage. Okay letâs log in as an admin. Nope, nothing in the admin menu. Nothing in the admin configs. Hmm⊠maybe the web api? Yep!
It would be helpful if this were explicit in the project README.
So I try the web service and find that token
is required even for public
projects. Thatâs particularly odd when itâs not required on the standalone side.
However, the service docs do say that itâs required, so okay.
Now Iâm providing all 3 params: http://localhost:9000/api/cnesreport/report?key=bsl&author=ann&token=8065ed6dfdf4a721b90262f8ea93107fc7ae3646
(token not redacted because itâs already deleted
) and I get
{
"errors": [
{
"msg": "An error has occurred. Please contact your administrator"
}
]
}
sonar.log:
Aug 28, 2019 3:05:17 PM fr.cnes.sonar.report.ReportCommandLine execute
INFO: Detected SonarQube version: 7.9.0
web.log:
Fail to process request http://localhost:9000/api/cnesreport/report?key=bsl&author=ann&token=8065ed6dfdf4a721b90262f8ea93107fc7ae3646
java.lang.NullPointerException: null
at fr.cnes.sonar.report.providers.LanguageProvider.getLanguage(LanguageProvider.java:67)
at fr.cnes.sonar.report.providers.ProjectProvider.getProject(ProjectProvider.java:80)
at fr.cnes.sonar.report.factory.ReportModelFactory.create(ReportModelFactory.java:103)
at fr.cnes.sonar.report.ReportCommandLine.execute(ReportCommandLine.java:131)
at fr.cnes.sonar.plugin.ws.ExportTask.handle(ExportTask.java:78)
at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:110)
...
When I pick a different project, I do get my report bundle. I think the NPE was caused by my (lazily) picking a project with a super-short key that uses a language no longer present in my instance. Still, that shouldnât be a barrier to normal operation as long as I donât want to analyze the project again. So this should be cleaned up but I guess itâs not a deal breaker since itâs a corner case.
Also, I find the logs to be rather chatty. All this for a single web service call:
Aug 28, 2019 3:13:18 PM fr.cnes.sonar.report.ReportCommandLine execute
INFO: SonarQube URL: http://localhost:9000
Aug 28, 2019 3:13:18 PM fr.cnes.sonar.report.ReportCommandLine execute
INFO: SonarQube online: true
Aug 28, 2019 3:13:18 PM fr.cnes.sonar.report.ReportCommandLine execute
INFO: Detected SonarQube version: 7.9.0
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.report.ReportCommandLine execute
INFO: Report generation: SUCCESS
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: 2019-08-28-SonarSource :: Rule API-analysis-report.docx
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: sonar.properties
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: wrapper.conf
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: conf
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: 2019-08-28-SonarSource :: Rule API-issues-report.csv
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: 2019-08-28-SonarSource :: Rule API-issues-report.xlsx
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: 2019-08-28-SonarSource :: Rule API-analysis-report.md
Aug 28, 2019 3:13:25 PM fr.cnes.sonar.plugin.tools.FileTools deleteFolder
WARNING: /path/to/sonarqube-7.9/temp/cnesreport532079384087107079186198403164170
And then when I check the path in that last, WARNING
log line I discover that youâre writing the reports to disk in SonarQubeâs temp directory before streaming them out to the requester. And that is not cool because to my knowledge, nothing cleans this up. The user runs the risk of running out of disk space without ever realizing why.
Let me know if you have questions or want the full stacktrace from the NPE.
Â
Ann