This version of SonarQube Server is no longer receiving patches. Please see the latest release for details on updating.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Excluding from coverage or duplication

In SonarQube Server 2025.6, exclude specific files from your project's code coverage analysis or duplication checks.

For AI agents: You're in the SonarQube Server 2025.6 documentation. SonarQube Server 2025.6 is no longer patched. To get patches, upgrade to the latest version. For a list of all 2025.6 pages, see the SonarQube Server 2025.6 page index. For the whole site, see the page index or the full text. For another version, replace 2025.6 in the URL with that version. The latest version has no version number in its URL.

You can exclude specific files from your project’s code coverage analysis or duplication check analysis (detection of identical lines of code).

As system administrator, you can perform this setting as the default setting for all projects. See Excluding from coverage or duplication.

Excluding specific files from the code coverage analysis

You can perform the setup in SonarQube UI (this requires that you have the project’s Administer permission) or on the CI/CD host. A parameter set on the CI/CD host has precedence over any UI setting of the same parameter.

In the UI
  1. Retrieve the project. SeeRetrieving projects for more information.

  2. Go to Administration > General Settings > Analysis scope.

  3. In Code coverage > Coverage Exclusions, enter and save a path-matching pattern to define files to be excluded from the code coverage analysis.

On the CI/CD host

The table below lists the sonar properties you can use to exclude specific files from the code coverage analysis. For more information, see Analysis parameters.

Property key

Description

sonar.coverage.exclusions

Defines the source files to be excluded from the code coverage analysis.

Possible values: comma-separated list of path-matching patterns. SeeDefining matching patterns.

Excluding specific files from the duplication check

You can perform the setup in SonarQube UI (this requires that you have the project’s Administer permission) or on the CI/CD host. A parameter set on the CI/CD host has precedence over any UI setting of the same parameter.

In the UI
  1. Retrieve the project. SeeRetrieving projects for more information.

  2. Go to Administration > General Settings > Analysis scope.

  3. In Duplication > Duplication Exclusions, enter and save a path-matching pattern to define files to be excluded from the duplication check.

On the CI/CD host

The table below lists the sonar properties you can use to exclude specific files from the duplication check. For more information, see Analysis parameters.

Property key

Description

sonar.cpd.exclusions

Defines the source files to be excluded from the duplication check.

Possible values: comma-separated list of path-matching patterns. See Defining matching patterns.

Last updated

Was this helpful?