Sonar quality metrics

Until you start thinking of code quality metrics violations in the same way as failed unit tests, you will always be playing catch-up. Now let me enumerate some of Sonar metrics that I find very useful for my Java projects. You can hook up Eclipse to your Sonar instance to get violation highlighting, synced up metrics for each project and more.

Sonar and its metrics are about improving the code quality. In my previous post, I covered the reasons why software quality metrics should be collected and why improvements to the code should be made based on those metrics. For a successful incorporation of Sonar (or any other metrics tool) into your software development shop, there is one issue worth discussion at the beginning. I won’t go into details of them because there are people much smarter than me who have sufficiently covered the importance of each of those metrics and how to maximize them in your code. If you are collecting your metrics as part of a Maven or Ant build, then you can configure the build to fail if Sonar gave you an error” alert after the analysis.

Currently, Sonar can gather metrics on your project by being invoked through Maven, Ant, command line (Sonar Runner), or CI Engines (e.g. Bamboo, Hudson, Jenkins, TeamCity, etc). You can try the nemo instance or the apache instance Those instances have software metrics of real open-source projects that are being updated periodically. I’ll link to Sonar documentation of how those metrics are incorporated into Sonar.

I’ll just ask you take the time and explore what each metrics means (Wikipedia is always a good place to start). Sonar has lots of different metrics available and because of that you might want to focus your team’s effort on manageable number of metrics. If you find that some metrics got worse in those events, you can come up with a strategy to avoid that dip next time.

It enables me to drill down through metrics starting from project-level, through library-level, package-level, and class-level. There are a wide variety of graphical representations that sonar uses to present metrics in an intuitive manner. You should never use Sonar or metrics to point the finger because that’s not what the tool is about. The metrics can be count by strain gauge formula for resistance.

Of course, organizations can control access to their Sonar instances so that only authorized personnel have access to those metrics. Sonar goes beyond just collecting and displaying metrics: In this post I’ll be illustrating how Sonar can fulfill the job of collecting metrics and driving decisions.

Leave a Reply

Your email address will not be published. Required fields are marked *