Sonarqube Report generation Options from command line

For a given gitlab branch, is it possible to generate a html report from command line with these filters Severity, Resolution , issues fixed with NOSONAR tag . By severity I mean - Critical, Major, Minor, etc. By Resolution, I mean Fixed, False positive, etc. I have several micro services and hence looking to do from command line. Using GUI is not needed as I have many projects. This would be best if available, otherwise is it possible to get the details using API, more details below.

Using API, I figured out this helps a bit.
url: “{sonarReportUrl}/api/measures/component?componentKey={componentKey}&metricKeys=metricsNames&analysisId={taskId}&branch=${branch}”

This generates actual output below, which is not useful. Along with this, I also need what are those major, minor issues with file names and Issues fixed with NOSONAR tag. (As a note - The generated report output is staged in Artifactory)

Request your expertise in this regard. I appreciate any inputs to figure a solution for this problem.

API Output
“uncovered_conditions”: 171,
“wont_fix_issues”: 0,
“bugs”: 0,
“info_violations”: 118,
“sqale_rating”: 1,
“code_smells”: 107,
“minor_violations”: 15,
“vulnerabilities”: 27,
“conditions_to_cover”: 876,
“ncloc”: 5185,
“duplicated_lines_density”: 1.1,
“major_violations”: 10,
“branch_coverage”: 80.5,
“reliability_rating”: 1,
“critical_violations”: 0,
“coverage”: 89.7,
“blocker_violations”: 0,
“complexity”: 834,
“lines_to_cover”: 2577,
“security_rating”: 2,
“uncovered_lines”: 186,
“false_positive_issues”: 0

Thank you.

Each microservice gitlab java project publishes to Sonarqube via Jenkins build. I am using Enterprise Edition - Version 7.9.1 . Thank you!


You’ll need to build such reports yourself, however you won’t be able to query by analysis, but by date. Take a look at api/measures/search_history.

For issues, you’ll only be able to get current state. You can pull them with the api/issues services.


1 Like

Thanks for quick reply. I am not familiar how to build such html reports - can you please describe bit more. I will work it out.

Would you be able to provide API examples for below

  • to pull data for NOSONAR tag.
  • to get file names and path having Major, Minor issues. And, Is it possible to get such a data using API from git master or any branch.

Thank you and appreciate reply.

Hi, Please suggest on the query above and is it possible to query by latest git tag and not by date. Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.