changed 'loc' and 'lines of code' to use 'ncloc' sonar metric, correction to replace all underscores in the label instead of just the first

This commit is contained in:
Jeffrey Barrus 2015-05-25 14:19:49 -06:00
parent 98a475f601
commit d0a19d73d8

View File

@ -554,14 +554,14 @@ camp.route(/^\/sonar\/(http|https)\/(.*)\/(.*)\/(.*)\.(svg|png|gif|jpg|json)$/,
var sonarMetricName;
if (metricName === 'tech_debt') {
sonarMetricName = 'sqale_debt_ratio';
} else if (metricName === 'lines') {
} else if (metricName === 'loc' || metricName === 'lines_of_code') {
sonarMetricName = 'ncloc';
} else {
sonarMetricName = metricName
}
var apiUrl = scheme + '://' + serverUrl + '/api/resources?resource=' + buildType
+ '&depth=0&metrics=' + encodeURIComponent(sonarMetricName) + '&includetrends=true';
var badgeData = getBadgeData(metricName.replace('_', ' '), data);
var badgeData = getBadgeData(metricName.replace(/_/g, ' '), data);
request(apiUrl, { headers: { 'Accept': 'application/json' } }, function(err, res, buffer) {
if (err != null) {