A simple node.js server that will display badges for Code Coverage from a source SonarQube server
Switch branches/tags
Nothing to show
Clone or download
Latest commit c032aed May 31, 2016


Sonar Coverage Badge

This is a small node.js server that will generate a coverage badge (similar to: http://coveralls.io/) but from a SonarQube server.


node src\\index.js --port=8087 or npm start

Then simply specify three parameters:

  • *server* - Hostname of the target SonarQube server
  • *resource* - the key as defined by http://{SONAR}/api/projects
  • *metrics* - usually either 'coverage' or 'branch_coverage'
  • Example: http://localhost:8087/?server=nemo.sonarqube.org&resource=junit:junit&metrics=coverage&ssl=true

    Will display:

    Note about SSL

    There is a quick way to turn on SSL queries if your SonarQube server requires SSL.
    Just add ssl=true to the end of the query string.
    All of the examples in this README referencing Nemo.sonarqube.org have SSL enabled.

    Color Settings

    To adjust the badge colors, simply update the colorSettings var at the beginning of the script. Note that it will be evaluated in order.



    <a href="http://nemo.sonarqube.org/drilldown/measures/252031?metric=coverage">
    	<img src="http://localhost:8087/?server=nemo.sonarqube.org&resource=junit:junit&metrics=coverage&ssl=true" />


    <a href="http://nemo.sonarqube.org/drilldown/measures/875157?metric=coverage">
    	<img src="http://localhost:8087/?server=nemo.sonarqube.org&resource=org.sonarsource.javascript:javascript&metrics=coverage&ssl=true" />