Search code examples
sonarqubesonarqube-web

How to display metric value on sonarqube dashboard?


Is it possible to display the metrics value on the sonarqube dashboard directly through html.erb file? One of my metric is Rank

Can I just write <%= format_measure('Rank') %> to display on the dashboard? This donot print anything on dashboard.


Solution

  • The format_measure is indeed the correct helper to print out the value of a metric in a widget.

    There can be several reasons why you don't see the measure for that metric:

    • you haven't run any analysis on the project, in which case your plugin haven't pushed the measure for that metric yet
    • your plugin does not push correctly measure for that metric
      • Ex.: it pushes measures at file level but not at project level

    In any case, you can take a look at our sample plugin to learn more, and more specifically at the widget template.