-
Bug
-
Resolution: Fixed
-
Major
-
-
3.0.2
private static final String SONAR_ISSUES_BASE_URL = "/api/issues/search?ps=1&projectKeys=";
I don't believe this URL is getting what you expect. It returns the total number of issues in the entire sonarqube system whether you have the projectKeys request parameter or not.
I believe to get the issues by project you need the following:
$sonarurl="${SonarHostUrl}api/measures/component?metricKeys=code_smells,ncloc,duplicated_lines_density,open_issues,sqale_rating,critical_violations,blocker_violations,major_violations,vulnerabilities,complexity,sqale_index,sqale_debt_ratio,violations&component=$SonarProjectKey"
You have to specify the metrics you want returned
Then on the returned JSON, you need to get:
$sonmeasures=$sonresult.component.measures
This object will contain the metrics only for the project you are looking for.
I'd be happy to talk further if anything isn't clear. I love this plugin, btw. Makes our grafana dashboards very helpful.
Hi cburne
I haven't had any issues with SonarQube data. Are you getting incorrect data and what data is incorrect?
The metrics URL is right there a few lines under SONAR_ISSUES_BASE_URL divided into two variables: SONAR_METRICS_BASE_URL and SONAR_METRICS_BASE_METRIC (source). The issue URL is only used for getting the total amounts different issue severities of the project. All others get their data from the metrics URLs.