Only Software matters

Experiences in software development

SonarQube meets scm statistics

Posted by Patroklos Papapetrou on September 21, 2013

Software quality is about a lot more than slinging good code. As a developer you use numerous tools, techniques, frameworks, and processes as you write, organize, build, test, refactor, and continuously improve your applications. SonarQube (Sonar), a free and open source quality platform, makes it radically easier to track, manage, and enhance the overall quality of your code. It leverages respected tools like Findbugs, PMD, and Checkstyle, and implements well-established best practices to provide a full-featured, robust platform for code quality measurement, review, and remediation. Originally Java-only, SonarQube now works with many other languages.

On the other hand your source code is (or at least should be) placed at a repository. Have you ever wondered who’s the developer that performs most commits or what time of the day dev-teams use to commit their changes back to the code base. These are some of the questions you can get by analyzing scm change logs. There are a few well-known open source tools (, ) for that purpose but each one of them handles only one scm type and all seem to be somehow deprecated. But the need of getting statistics about your code base still exists.

So some months ago I decided to start implementing the SonarQube SCM Stats plugin that gathers statistics from project’s source control repository and graphically display them in various ways. Currently the plugin – already in its third release –  focuses on collecting change logs for the most famous repository types. Git, Subversion, CVS, Mercurial , Perforce are partially or fully supported and after proper manipulation the plugin displays a SonarQube dashboard with the following graphs :

  • Commits / Author : displays only the top 10 authors ( list and pie chart views)
  • Authors activity : displays a stacked 3D bar chart about top 10 authors activities types : New files, modifications and / or deletions(red)
  • Commits / Hour :  displays in a bar chart the number of commits per clock hour
  • Commits / Day : displays in a bar chart the number of commits per week day
  • Commits / Month : displays in a bar chart the number of commits per month

And that’s only the beginning. In the next couple of months I intend to add some more graphs about file types, authors activities and of course improve and extend the coverage of other scm types.

If you already use SonarQube for tracking the quality of your source code, then SCM Stats plugin is a useful add-on that let you discover the secret statistics of your code base. Why don’t you give it a try?


Don’t forget to follow me at Twitter or connect with me at LinkedIn or subscribe to this blog’s RSS feed.

One Response to “SonarQube meets scm statistics”

  1. frague59 said

    Is this plugin available for sonar 5.3 ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: