# Excluding test project code smells

**URL:** <https://community.sonarsource.com/t/excluding-test-project-code-smells/47863>\
**Category:** SonarQube Cloud\
**Created:** [August 10, 2021, 12:48pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863 "2021-08-10T12:48:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattKatrina\_Bryant](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mattkatrina_bryant/32/16912_2.png) [@MattKatrina\_Bryant](https://community.sonarsource.com/u/MattKatrina_Bryant)\
**Post date:** [August 10, 2021, 12:48pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863/1 "2021-08-10T12:48:00Z")

</div>

Hi,

A solution I’m analysing in SonarCloud via Azure Pipelines is showing code smells in the test projects. I would like to prevent code smells in test projects being analysed but I can’t seem to prevent it.

I tried sonar.exclusions to add the test project but they weren’t excluded and I don’t know if this is the correct approach anyway.

Please see image. Any assistance would be appreciated.

Thanks

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/8/a/8a37a7d33e972dbc89fe48ce85f06c276d0ec83a.png)

---

<div class="post-metadata">

**Author:** ![Claire\_Villard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/claire_villard/32/27065_2.png) [@Claire\_Villard](https://community.sonarsource.com/u/Claire_Villard)\
**Post date:** [August 10, 2021, 12:58pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863/2 "2021-08-10T12:58:24Z")

</div>

Hi @MattKatrina_Bryant , welcome to the community forum!

Your idea of using exclusions seems to right one to me, except that to exclude test files, you should use the `sonar.test.exclusions` property instead of `sonar.exclusions`.  
It should remove all the issues found in the files matching the exclusion pattern.  
More information about narrowing the analysis scope is available [here](https://sonarcloud.io/documentation/advanced-setup/analysis-scope/).

If you would like to remove only some of them because they are not relevant for you, you can also disable the rules generating those issues in your Quality Profile definition.  
Documentation about quality profiles is [here](https://sonarcloud.io/documentation/standards/managing-quality-profiles/).

HTH,  
Claire

---

<div class="post-metadata">

**Author:** ![MattKatrina\_Bryant](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mattkatrina_bryant/32/16912_2.png) [@MattKatrina\_Bryant](https://community.sonarsource.com/u/MattKatrina_Bryant)\
**Post date:** [August 10, 2021, 1:02pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863/3 "2021-08-10T13:02:32Z")

</div>

Thanks. I will give that a go and let you know how it went

---

<div class="post-metadata">

**Author:** ![MattKatrina\_Bryant](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/mattkatrina_bryant/32/16912_2.png) [@MattKatrina\_Bryant](https://community.sonarsource.com/u/MattKatrina_Bryant)\
**Post date:** [August 10, 2021, 1:10pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863/4 "2021-08-10T13:10:07Z")

</div>

Magic thanks. All works

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [August 17, 2021, 1:10pm UTC](https://community.sonarsource.com/t/excluding-test-project-code-smells/47863/5 "2021-08-17T13:10:48Z")

</div>

Closed on August 17, 2021, 1:10pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
