# File exclusions arent applied when commiting in IntelliJ

**URL:** <https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719>\
**Category:** IntelliJ Platform\
**Tags:** exclusions, intellij\
**Created:** [January 14, 2020, 11:08am UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719 "2020-01-14T11:08:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![renoth](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@renoth](https://community.sonarsource.com/u/renoth)\
**Post date:** [January 14, 2020, 11:08am UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/1 "2020-01-14T11:08:43Z")

</div>

When having the following Exclusions in SonarLint and the project is synchronized with a sonarQube server having the same Exclusions  
 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/1/12bc24928443f4501f240d36a5f3c0d7e9cdc3f8.png)

when i try to commit i still get the warning about errors in my test classes:

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/f/ffad04bd8106e0a7ed5602fc7202ed40a273e2b5.png)

I also have the same exclusions globally in my SonarQube installation

I don’t understand why i still get the warning about the SonarQube issues although i excluded the class from scanning.

I am using IntelliJ 2019.3.1 and SonarLint 4.4.

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [January 21, 2020, 3:19pm UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/2 "2020-01-21T15:19:21Z")

</div>

Hi,

> When having the following Exclusions in SonarLint

This is maybe confusing, but exclusions you configure in IntelliJ are only taken into account if you are _not_ in connected mode. In connected mode we are trying to be as close as we can to server configuration, so we are only using server side exclusions configuration.

> I also have the same exclusions globally in my SonarQube

Can you give us the key of the property configured on server side? Is it `sonar.exclusions` or `sonar.global.exclusions`?  
Is the file possibly classified as a test by SonarLint and not by SonarQube (or the other way around?).

---

<div class="post-metadata">

**Author:** ![renoth](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@renoth](https://community.sonarsource.com/u/renoth)\
**Post date:** [January 21, 2020, 3:57pm UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/3 "2020-01-21T15:57:19Z")

</div>

Hi Julien,

Thank you for the reply, we have the following configuration on the SonarQube server:

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/5/5303093d2f17b75b80156b19fbd2022c3129e9b3.png)

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [January 21, 2020, 4:03pm UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/4 "2020-01-21T16:03:48Z")

</div>

Are the file exclusion applied when running analysis manually on the file?

If not, could you please enable verbose logs in the SonarLint panel, trigger an analysis, and give me logs. Should be something like:

```auto
Configuring analysis with org.sonarlint.intellij.analysis.JavaAnalysisConfigurator
Using configuration of 'org.sonarsource.sonarlint.intellij:sonarlint-intellij' in server 'Dory'
Analysing 'ConnectedSonarLintFacade.java'...
Starting analysis with configuration:
[
  projectKey: org.sonarsource.sonarlint.intellij:sonarlint-intellij
  baseDir: /home/julien/Prog/Projects/sonar-intellij
  extraProperties: {dont_care}
  inputFiles: [
    file:///home/julien/Prog/Projects/sonar-intellij/src/main/java/org/sonarlint/intellij/core/ConnectedSonarLintFacade.java (UTF-8)
  ]
]

```

---

<div class="post-metadata">

**Author:** ![renoth](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@renoth](https://community.sonarsource.com/u/renoth)\
**Post date:** [January 21, 2020, 4:27pm UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/5 "2020-01-21T16:27:24Z")

</div>

When i run the check manually on the file the exclusions are not applied.

When i run the check on the VCS modified files the exclusion is applied.

When i run the check on the VCS modified files after not clearing the manual results from the Testfile the exclusion is applied but the issues remain visible in the VCS changed file view.

When i commit and the pre-commit check is executed, the exclusion is not applied.

In this case the log says:

> Trigger: CHECK\_IN  
> [Pre-commit check] 5 file(s) submitted
> 
> …
> 
> inputFiles: [  
> file:// … FooTest.java (UTF-8) [test]  
> ]
> 
> Available languages:
> 
> - Python =\> “py”
> - Java =\> “java”
> - XML =\> “xml”
> - JavaScript =\> “js”  
> Start analysis  
> Declared extensions of language Python were converted to py: **/_.py  
> Declared extensions of language Java were converted to java: \*\*/_.java,**/_.jav  
> Declared extensions of language XML were converted to xml: \*\*/_.xml, **/\*.xsd,** /_.xsl  
> Declared extensions of language JavaScript were converted to js: \*\*/_.js, **/\*.jsx,** /\*.vue  
> Index files  
> Language of file ‘file://FooTest.java’ is detected to be ‘java’  
> 0/0 source files have been analyzed  
> 1 file indexed  
> Quality profiles:
> - …
> 
> * * *
> 
> Java Main Files AST scan  
> 0 source files to be analyzed  
> Java Main Files AST scan (done) | time=0ms  
> Java Test Files AST scan  
> 0/0 source files have been analyzed  
> 1 source files to be analyzed  
> Initializing metadata of file file://FooTest.java  
> 1/1 source files have been analyzed  
> Java Test Files AST scan (done) | time=74ms  
> ‘Python Squid Sensor’ skipped because there is no related file in current project  
> Execute Sensor: JavaXmlSensor  
> ‘XML Sensor’ skipped because there is no related file in current project  
> ‘SonarJS’ skipped because there is no related file in current project  
> ‘ESLint-based SonarJS’ skipped because there is no related file in current project  
> Processed 41 issues in 98 ms  
> Found 41 issues

Without the issues in the Testclass it would be 39 issues.

---

<div class="post-metadata">

**Author:** ![Julien\_HENRY](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/julien_henry/32/61_2.png) [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Post date:** [January 27, 2020, 10:06am UTC](https://community.sonarsource.com/t/file-exclusions-arent-applied-when-commiting-in-intellij/18719/6 "2020-01-27T10:06:50Z")

</div>

Thanks, I managed to reproduce, and this is already tracked in this ticket:  
[https://jira.sonarsource.com/browse/SLI-356](https://jira.sonarsource.com/browse/SLI-356)

We will fix it in the next sprint.
