# File exclusions

All versions of SonarQube for IDE will fetch file exclusions from SonarQube (Server, Cloud) or SonarQube Community Build when you bind a project while running in connected mode. Locally defined file exclusions will be ignored when running in connected mode. For more information about how SonarQube for Visual Studio settings are handled by the server, look at the server documentation on setting your analysis scope:

* See the [Setting analysis scope](/sonarqube-server/2026.1/project-administration/adjusting-analysis/setting-analysis-scope.md) pages in SonarQube Server.
* See the [Analysis scope](/sonarqube-cloud/managing-your-projects/project-analysis/setting-analysis-scope.md) pages in SonarQube Cloud.
* See the [Setting analysis scope](/sonarqube-community-build/project-administration/adjusting-analysis/setting-analysis-scope.md) pages in SonarQube Community Build.

## File exclusions in the IDE <a href="#file-exclusions-in-the-ide" id="file-exclusions-in-the-ide"></a>

When running in [Connected mode](/sonarqube-for-intellij/connect-your-ide/connected-mode.md) with SonarQube (Server, Cloud) or SonarQube Community Build, SonarQube for IDE will ignore local exclusions and fetch file exclusions from the SonarQube (Server, Cloud) server.

## Defining file exclusions <a href="#defining-file-exclusions" id="defining-file-exclusions"></a>

When not using connected mode, it's possible to define file exclusions locally. Go to **IntelliJ Settings** > **Tools** > **SonarQube for IDE** > **File Exclusions** to define an exclusion pattern. Wildcards are allow, using the [#wildcard-patterns](#wildcard-patterns "mention") listed below.

{% hint style="info" %}
File exclusions defined in IntelliJ only apply when *not running in Connected Mode*. When a project is bound to a SonarQube (Server, Cloud) project, exclusions defined in the server’s **General Settings** override locally defined exclusions.
{% endhint %}

## Wildcard patterns <a href="#wildcard-patterns" id="wildcard-patterns"></a>

The recognized path-matching patterns are case-sensitive and defined using the following wildcards:

* `*` Match zero or more characters (not including the directory delimiter, `/` ).
* `**` Match zero or more directory segments or files within the path.
* `?` Match a single character (not including the directory delimiter, `/` ).

**Wildcard examples**

* The pattern `**/*.css`
  * matches `anyDirectory/anyFile.css`
  * doesn’t match `org/sonar.api/MyBean.java`
* The pattern `**/*Bean.java`
  * matches `org/sonar.api/MyBean.java`
  * doesn’t match `org/sonar.api/mybean.java` or `org/sonar/util/MyDTO.java`
* The pattern `**/*Bean?.java`
  * matches `org/sonar/util/MyOtherBean1.java`
  * doesn’t match `org/sonar/util/MyOtherBean.java`
* The pattern `org/sonar/*`
  * matches `org/sonar/MyClass.java`
  * doesn’t match `org/sonar/util/MyClassUtil.java`
* The pattern `org/sonar/**/*` is equivalent to `org/sonar/**` and
  * matches `org/sonar/anyDirectory/anyFile`
  * matches `org/sonar/MyClass.java`
  * doesn’t match `org/radar/MyClass.java`


---

# 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-for-intellij/using/file-exclusions.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.
