Differential Services in Sonar for a Complete Support of Continuous Inspection

by freddy mallet|

    One of the main objective for Sonar in 2011 is to go a step further in the support of Continuous Inspection. Indeed, prior to version 2.5, Sonar could already take a snapshot of the overall quality of an application and view the evolution of quality measures across snapshots with the TimeMachine service. But this was not sufficient to provide at quick answers to some very valuable questions such as :

    • what changed in my application over last 30 days ?
    • did quality improve during version 2.7 software increment ?
    • which violations have been created since 1st of January and by who ?
    • how much is new code covered by unit tests ?
    • which projects have increased their technical debt during last 3 months ?
    • ...

    This is why we have decided to add support for what we call differential services in Sonar 2.5 (differential dashboards and new violations) and completed the job in Sonar 2.7 (new code coverage). With this latest version, you're just two clicks away from those answers :

    What changed over the past X days or since version X.Y.Z ?

    On a project dashboard, simply pick the desired period in the drop down list “Time changes…” :

    When a period is selected, the differential values will appear next to the project measures. So, it’s pretty easy to see for instance how the density of comments has changed in the last 30 days. In the following example, it has increased by 1.2% :

    You can define up to five different periods for each projects. The three first periods can be defined in the global Settings page and are the same for all projects :

    And two additional periods can be defined in the Settings page of each project.

    Which violations have been created ?

    In the Violations drilldown page, the same drop down list "Times changes..." is available and can be used to display only newly created violations over a period of time :

    When clicking on a file, only newly created violations on this file are displayed :

    How much is new code covered by unit tests ?

    This functionality requires the SCM Activity plugin. In project dashboard, as soon as a period is selected, a new section appears :

    In this example, to get for instance the list of lines of code which have been added over the past 30 days and which are not covered by unit tests, just click on "61.2% line coverage" :

    Among projects, which ones have the highest number of new violations ?

    In fact this is possible to track changes on any measure and in this examples we track evolution of number of violations, number of lines of code and unit test durations over the past 90 days :

    These new services clearly add further control on technical debt management and this is now time to give them a try.

    To extend all those tracking services, we are busy working on Sonar 2.8 to provide... the ability to perform manual code reviews !