Dashing widget to display Sonar metrics, connecting to either a secured or unsecured Sonar repository.
I created this widget after originally attempting to use EHadoux's simple Sonar widget, which did not allow access to my company's secured Sonar instance. Additionally, I implemented the ability to set up the widget using an external configuration file.
Please note that this is technically a job versus a widget, in that it periodically requests data from Sonar and pushes that to the list widget as the view.
The list widget packaged with the Dashing framework.
##Usage
Copy sonar.rb
and sonar.cfg
into the jobs
directory.
Add the following snippet to the dashboard layout file:
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="sonar" data-view="List" data-title="sonar stats" data-unordered="true" data-moreinfo="values as %">
</div>
</li>
To display more metrics, increase the data-sizey attribute.
Change the values for the configuration in sonar.cfg
. All values are required except for username
and password
. If no username is provided, it is assumed the Sonar instance is unsecured. Order of display in the widget is dictated by the order of configured metrics.
If sonar.cfg
is not found, the dashboard will fail to start with a "file not found" message.
Job implementation requires restarting Dashing if you change the configuration file.
Not sure if someone is still using this, i was willing to give a try to see what can be done with Smashing, but :
/api/resources/
is now deprecated + JSON output has changed)Anyway the working GIST should now be (tested today on SonarQube 7.9.2) :
No changes expected in
sonar.cfg
(for example, for metrics i was using, in case keys have changed :duplicated_lines,coverage,blocker_violations,major_violations
)By the way, list of available metrics can now be retrieved (for debugging purpose) through
/api/metrics/search