Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 a Differential Services feature is provided on measures, violations issues and coverage by unit tests on new code.

...

To activate this service, pick the desired period in the drop down list Time changes... drop down list:

Image RemovedImage Added

When a period is selected, the differential values will appear next to the project measures:

Image RemovedImage Added

Differential Views on

...

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

Image Removed

Image Removed

Issues

When clicking on the "Added:" link available on the "Issues and Technical Debt" widget (see previous screenshot), this will initiate a drilldown on issues based on the corresponding period and keep this period all the way through:

Image Added

To determine the creation date of a violationan issue, during each Sonar analysis, Sonar executes the following algorithm :is executed to determine if an issue is new or existed previously. For each

...

issue, three of four criteria (rule; line number; line content or "hash"; and message) must match for a detected issue to be matched up with an existing one:

  • 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) > MATCHFor 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 issue is a new one.

Info
titleI am not getting the expected new violations issues in the Violations Issues drilldown service when a differential view is selected?

Three reasons can explain this:

  1. This Violations drilldown Issues Drilldown service only shows 'Added Violations'added issues, 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 (that displays added issues - fixed issues).
  2. The algorithm detecting new violations issues is very good but still perfectible. Therefore new violations issues can sometimes appear only because Sonar SonarQube 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 version 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 data to build this service were not collected. This issue will disappear as soon as period does not go beyond first analysis.

...

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.

Image RemovedImage Added


A live example is available on NemoSonar (from Git).

Anchor
settingsDifferentialViews
settingsDifferentialViews

Differential Views Settings

Global Configuration

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

Project Configuration

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