"sonar-report.json" - Is this file still available?

Hi @Christoph_Forster,

It is possible to get a report of the analysis with full issue details (number of issues, types, lines of code, …), but I don’t know if it is in the format expected by Jenkins.

We also use Jenkins and we don’t use its Sonar plugin but rather have a custom script that performs the analysis and sets a Gerrit score.

  1. In order to get the report, take a look at the report-task.txt file generated by the scanner after it has finished. You first need to check that the server hea finished to process the analysis by downloading the URL of ceTaskUrl

The file looks like this:
{
“task”: {
…,
“status”: “PENDING”,

}
}

Keep downloading the ceTaskUrl file until the status shows SUCCESS (you can query this JSON file using the jq utility).

  1. Once the server finished processing the analysis, you can download your report by querying the server using the Web API. The right API is /api/issues. The URL you should download is something like this:

    $serverUrl/api/issues/search?componentKeys=$projectKey&branch=$DEV_BRANCH&resolved=false&facets=severities

This is I think the file you are looking for. It contains all issues with the comments that appear on Sonar. We only use it to set the score, but it is possible to extract the comments using jq and send the comments to Gerrit.