SonarQube Meets SCM Statistics
The Agile Zone is brought to you in partnership with Hewlett Packard Enterprise. Discover how HP Agile enterprise solutions can help you achieve high predictability and quality in your development processes by knowing the status of your projects at any point in time.
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 in a repository. Have you ever wondered which developer performs the most commits or what time of the day dev teams 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 (StatSVN, GitStats, StatCVS ) for that purpose, but each one of them handles only one SCM type and all seem to be somewhat deprecated. But the need to get statistics about your code base still exists.
So, a few months ago I decided to start implementing the SonarQube SCM Stats plugin that gathers statistics from a 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 and 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 the top 10 authors' activity 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 weekday
- 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 lets you discover the secret statistics of your code base. Why don’t you give it a try?