# Excluding from coverage or duplication

As a system administrator, you can exclude specific files from code coverage analysis or duplication check at the global level. It means that this analysis scope adjustment applies to all projects in your instance. However, they can be overridden at the project level in the UI or through analysis parameters set on the CI/CD host.

## Excluding specific files from the code coverage analysis <a href="#from-coverage" id="from-coverage"></a>

To exclude specific files from the test coverage:

1. Go to **Administration** > **Configuration** > **General Settings** > **Analysis Scope**.
2. In **B. Code coverage Exclusions**, enter and save a path-matching pattern to define files to be excluded from the code coverage analysis: see [defining-matching-patterns](https://docs.sonarsource.com/sonarqube-server/2026.1/project-administration/adjusting-analysis/setting-analysis-scope/defining-matching-patterns "mention").

## Excluding specific files from the duplication check <a href="#from-duplication" id="from-duplication"></a>

To exclude specific files from the duplication check (detection of identical lines of code):

1. Go to **Administration** > **Configuration** > **General Settings** > **Analysis Scope**.
2. In **C. Duplication Exclusions**, enter and save a path-matching pattern to define files to be excluded from the duplication check: see [defining-matching-patterns](https://docs.sonarsource.com/sonarqube-server/2026.1/project-administration/adjusting-analysis/setting-analysis-scope/defining-matching-patterns "mention").

## Related pages <a href="#related-pages" id="related-pages"></a>

* [excluding-files-based-on-file-paths](https://docs.sonarsource.com/sonarqube-server/2026.1/instance-administration/analysis-functions/analysis-scope/excluding-files-based-on-file-paths "mention")
* [advanced-exclusion-features](https://docs.sonarsource.com/sonarqube-server/2026.1/instance-administration/analysis-functions/analysis-scope/advanced-exclusion-features "mention")
* [setting-analysis-scope](https://docs.sonarsource.com/sonarqube-server/2026.1/project-administration/adjusting-analysis/setting-analysis-scope "mention")
* [test-coverage](https://docs.sonarsource.com/sonarqube-server/2026.1/analyzing-source-code/test-coverage "mention")


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/2026.1/instance-administration/analysis-functions/analysis-scope/exclude-from-coverage-duplication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
