Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Table of Contents

Being able to monitor how quality evolves is a good start (see Historical Information).

The next step would be to manage your technical debt on your current developments in order to keep it under control.

To deal with that, Sonar offers you the Differential Services feature on measures, violations and coverage by unit tests on new code.

Differential Views

Differential Views on Measures

To activate this service, 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:

Differential Views on Violations

This service will help you focus your effort of quality on current developments:

To determine the creation date of a violation, during each Sonar analysis, Sonar executes the following algorithm:

  • For each violation, if there was a violation on the same rule, with the same line number and with the same hash (but not necessarily with the same message) > MATCH
  • For each violation, if there was a violation on the same rule, with the same message and with the same hash (but not necessarily with the same line) > MATCH
  • For each violation, if there was a violation on the same rule, with the same message and with the same line number (but not necessarily with the same hash) > MATCH

In any other case, the violation is a new one.

I am not getting the expected new violations in Violations drilldown when a differential view is selected?


Three reasons can explain this:

  1. This Violations drilldown service only shows 'Added Violations', not fixed ones. Therefore the number you see in this service can be different from the one displayed on a dashboard through the Rules Compliance widget.
  2. The algorithm detecting new violations is very good but still perfectible. Therefore new violations can sometimes appear only because Sonar did not recognize it already existed.
  3. You are looking at a period of X days which goes beyond the first analysis made after migration to Sonar 2.5. In this case there can be a discrepancy due to the fact that prior to 2.5, Sonar was not collecting the info necessary to build this service. This issue will disappear as soon as period does not go beyond first analysis.


Code Coverage on New/Changed Code

When activating the SCM Activity Plugin, you will be able to separate coverage by unit tests of new code from old (based upon a given cut-off date) in order to track the new code which does not have any/enough unit tests.

A live example is available on Nemo: Sonar (from Git).

Differential Views Settings

Global Configuration

3 periods can be configured globally and will be available and common to all projects. Go to Configuration > General Settings > Differential Views to set these properties.

Project Configuration

2 complementary periods can be configured and be specific to the current project. Select your project and go to Settings > Differential Views to set these properties


  • No labels