> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/introduction.md).

# Introduction

Main steps for setting the project's analysis scope in SonarQube Server 2026.5.

There are many cases where you do not want to analyze every aspect of every source file in your project. For example, your project may contain generated code, source code from libraries, or intentionally duplicated code.

In such cases, it makes sense to skip some or all aspects of analysis for these files, thus removing noise and narrowing the focus to issues that really matter. To help narrow the focus, SonarQube Server gives you several options to precisely configure what will be analyzed and how.

{% hint style="info" %}
The new code definition of your project has an impact on the analysis scope. For more information, see [Quality standards and new code](/sonarqube-server/user-guide/about-new-code.md).
{% endhint %}

## Step 1: Check your project’s default initial scope <a href="#check-initial-scope" id="check-initial-scope"></a>

Check your project’s default initial scope. If it doesn’t suit you, you must set the initial scope explicitly.

See [Setting initial scope](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/setting-initial-scope.md).

## Step 2: If necessary, adjust the initial scope <a href="#adjust-initial-scope" id="adjust-initial-scope"></a>

You may have to adjust the initial scope mainly in the following cases:

* If the directory structure of your project does not cleanly separate source code from test code at the top level. In that case, you can exclude files based on path-matching patterns or file extensions by programming language.
* To exclude specific files from duplication check.
* To exclude specific files from coverage reporting.

You can also perform other exclusions, such as excluding files over a certain size limit or disabling the SCM’s file ignore patterns. In very few situations, you may have to use advanced exclusion features.

To exclude code from the analysis, you define exclusion parameters for the project. You can define most exclusion parameters:

* In SonarQube Server UI\
  This requires that you have the Administer permission for the project.\
  When possible, it is the recommended method since it allows a centralized, reliable, and user-friendly configuration.
* On the CI/CD host\
  With this method, you configure the respective sonar properties on the CI/CD host. Note that a parameter set through this method has precedence over any UI setting of the same parameter.

See:

* [Excluding based on path-matching patterns](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/excluding-files-based-on-patterns.md)
* [Excluding based on file extension](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/excluding-based-on-file-extension.md)
* [Excluding from coverage or duplication](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/exclude-from-coverage-duplication.md)
* [Applying advanced exclusions](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/advanced-exclusions.md)
* [Other adjustments](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/other-adjustments.md)

{% hint style="info" %}
Some exclusions can be defined at the global level for all projects. See the Analysis scope [Introduction](/sonarqube-server/instance-administration/analysis-functions/analysis-scope/introduction.md) page for more details.
{% endhint %}

## Step3: Verify the settings <a href="#verify-settings" id="verify-settings"></a>

After the first project analysis run, you can verify that the configured analysis scope is correct. See [Verifying analysis scope](/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/verifying-analysis-scope.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/project-administration/adjusting-analysis/setting-analysis-scope/introduction.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
