Agile Zone is brought to you in partnership with:

Experienced Java/Java EE Engineer (Architect and developer) , team leader and agile enthusiast. Most of the projects where the employee has been involved in the last 10 years were based on J2EE architectures. He has been working as a team leader and project manager for the last 8 years. He was technical leader and member of the development team for major projects in public sector such as National Municipal Registry, Online. Patroklos is a DZone MVB and is not an employee of DZone and has posted 18 posts at DZone. You can read more from them at their website. View Full User Profile

SonarQube Meets SCM Statistics

09.24.2013
| 5394 views |
  • submit to reddit

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,  GitStatsStatCVS ) 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?



Published at DZone with permission of Patroklos Papapetrou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)