date: 2018-04-09 menu: onprem: parent: tutorials notoc: true title: Leak Period weight: 90 description: Descriptions of the SonarQube Leak Period settings and using them effectively. layout: onprem — –>

SonarQube Leak Periods

SonarQube’s Leak Period is a great way to keep track of new issues in your project.

How the Leak Period is set determines what issues are displayed as ‘new’ issues. There are several options for this.

Date

By entering a date in the format yyyy-MM-dd, SonarQube will show the issues that have arisen since that date.

Number of days

By entering a single number, SonarQube will show the issues that have arisen since that number of days ago. Keep in mind that the issues found in the last 5 days will not be the same a week from now.

Previous version

By using the previous_version setting, the Leak Period will be tracked from the previous version set with the sonar.projectVersion parameter.

For example, a scan is run on a project with the sonar.projectVersion 1.0 . After time, the project’s sonar.projectVersion is set to 1.1. The Leak Period set to previous_version would display all issues that have arisen since sonar.projectVersion 1.0 .

Specific version

By entering your projects required sonar.projectVersion, the Leak Period will display all issues that have arisen since that specific version.

For example, a scan is run on a project with the sonar.projectVersion BASELINE. The project’s sonar.projectVersion is then set to DEVELOPMENT and all necessary scans are run over time. The Leak Period set to BASELINE would display all issues that have arisen since the original scan.

It is important to note that all violations, when they were introduced and the version they are introduced in are tracked. The Leak Period only filters this information on the project’s Overview dashboard and the Issues screen.

Abnormalities

Added Files

If you are baselining your projects with a full code base and using the same project key to compare branches of your code, some problems can arise. If the branch does not contain your full code base and you add files to your branch that were present in the initial baseline scan, it will count the files added as new files. This means all the violations present in those files will register as new violations.

There are two options to avoid this:

  1. Make sure your entire codebase is present in the branch, not just the files you are working on.
  2. Baseline your project with the full code base before every scan.

Only One Version

If there is only one version present in your project and the leak period is set to its default (previous_version), the leak period may not display properly. To display the leak period correctly, set the versions of your project scans with sonar.projectVersion or set the leak period to a certain date or number of days as mentioned above.

More information:

SonarQube: Fixing the Water Leak