For the net.masterthought:cucumber-reporting project shield does not display tech debt.
Problematic:
https://img.shields.io/sonar/http/nemo.sonarqube.org/net.masterthought:cucumber-reporting/tech_debt.svg
Working:
https://img.shields.io/sonar/http/nemo.sonarqube.org/com.puppycrawl.tools:checkstyle/tech_debt.svg
Project site at Sonar
https://sonarqube.com/dashboard/index?id=net.masterthought%3Acucumber-reporting
Same issue here with https://img.shields.io/sonar/http/sonarqube.com/com.github.dannil:scb-java-client/tech_debt.svg
Project at Sonar https://sonarqube.com/dashboard?id=com.github.dannil%3Ascb-java-client
In case it's helpful for anyone:
I had the same issue and saw that SonarQube has its own badge API - so I switched to using that for the time being:
https://github.com/QualInsight/qualinsight-plugins-sonarqube-badges/wiki/Measure-badges
e.g.: https://sonarqube.com/api/badges/measure?key=net.masterthought:cucumber-reporting&metric=sqale_debt_ratio
, or https://sonarqube.com/api/badges/measure?key=com.github.dannil:scb-java-client&metric=sqale_debt_ratio
Sonarqube API change: https://sonarqube.com/web_api/api/resources (deprecated since 5.4)
Old sample (sonarqube 5.1.2): http://sonar.qatools.ru/api/resources?resource=ru.yandex.qatools.allure:allure-core&depth=0&metrics=sqale_debt_ratio&includetrends=true
New sample (sonarqube 6.3): https://sonarqube.com/api/measures/component?componentKey=com.github.noraui:noraui&metricKeys=sqale_debt_ratio&includetrends=true
You need change code in this part of shields/server.js to calling new API:
var apiUrl = scheme + '://' + serverUrl + '/api/resources?resource=' + buildType
+ '&depth=0&metrics=' + encodeURIComponent(sonarMetricName) + '&includetrends=true';
The new API return this json sample:
{"component":{"id":"AVsmTVHJGqR9xtJfHMWb","key":"com.github.noraui:noraui","name":"NORAUI","description":"Non-Regression Automation for User Interfaces","qualifier":"TRK","measures":[{"metric":"sqale_debt_ratio","value":"0.4","periods":[{"index":1,"value":"0.0"}]}]}}
You need change code in this part of shields/server.js to use response of new API:
var value = data[0].msr[0].val;
var value = component.measures[0].value
Hi, thanks for this issue. Seems like we should try to support both versions. Could you open a pull request?
How can test this part "camp.route(/^\/sonar\/(http|https)\/(.)\/(.)\/(.*).(svg|png|gif|jpg|json)$/,...." in a development environnement please?
I read https://github.com/badges/shields/blob/master/doc/TUTORIAL.md and I have this trace:
macbooksgrillon:shields sgrillon$ node server.js 8080
/Users/sgrillon/Documents/info/shields/server.js:2031
let releases = data.releases[data.info.version];
^^^^^^^^
SyntaxError: Unexpected identifier
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
I thought I would add a parameter with the version of the target sonarqube
Ah, to fix that, you'll need to upgrade to Node 6. Would be worth adding that to the tutorial.
Thanks for looking into this!
I install node 7,
http://[::]:8080/try.html ready on my personal macbook, I read this issue this week.
I valid in my macbook:

I create a PR: https://github.com/badges/shields/pull/931 but travis-ci is KO with this trace:
[email protected] lint /home/travis/build/badges/shields
eslint '/.js'
/home/travis/build/badges/shields/server.js
911:15 error 'apiUrl' is already defined no-redeclare
928:19 error 'value' is already defined no-redeclare
✖ 2 problems (2 errors, 0 warnings)
npm ERR! Linux 4.8.12-040812-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v6.10.1/bin/node" "/home/travis/.nvm/versions/node/v6.10.1/bin/npm" "run" "lint"
npm ERR! node v6.10.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint:eslint '**/*.js'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script 'eslint '/.js''.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the gh-badges package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint '*/.js'
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs gh-badges
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls gh-badges
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/build/badges/shields/npm-debug.log
npm ERR! Test failed. See above for more details.
The command "npm test" exited with 1.
Here's some explanation of that error: http://eslint.org/docs/rules/no-redeclare
Because a var is scoped to the containing function and JavaScript does something called hoisting for variable declarations, putting multiple var declarations for the same identifier is allowed, yet confusing to the reader.
You're probably writing something like this:
if (...) {
var apiUrl = ...
} else {
var apiUrl = ...
}
You can write this instead:
var apiUrl;
if (...) {
apiUrl = ...
} else {
apiUrl = ...
}
I fixed issue (from javascript). This PR is finished and ready.
Hello @paulmelnikow, when do you put this evolution online?
I'll review and test PR #931 within the next week or so. We can discuss the changes there. Thanks again for opening that!
PRs #855 and #931 needed work and were closed without being merged. If anyone would like to revive them, feel free.
Most helpful comment
I fixed issue (from javascript). This PR is finished and ready.