Code coverage exclusions

I use SonarQube Community Version 8.9 and sonar-scanner 4.3.0.2102.
I want to exclude my main folders tests from code coverage. In the code tab, I always see the tests folder no matter what I try.
Until now, I have tried to put this code in sonar-project.properties :

sonar.coverage.exclusions=tests/**/*.*

this

sonar.coverage.exclusions=**tests/**/*.*

and numerous other things that I do not remember. I also tried some things via the web interface with no avail.

I have SonarLint 4.16.0.31683 in PHPStorm 2021.1.2 but I do not know if it can interferes.

Hi @lperamo ,

Welcome to SonarSource Community! :sonarsource:

Try this **/tests/**. You can use Digital Ocean’s Glob Tool to test it.

See here for more examples: Narrowing the Focus | SonarQube Docs

I tried **/tests/**, it works in your Digital Ocean link but not in the SonarQube interface.
I tried to change the file sonar-project.properties, it did not work so I change the settings in the interface but it does not work either.

(I already knew your link Narrowing the Focus | SonarQube Docs.)

Edit
In fact, I am not sure I believe that the percentage disappear to show -. So I still see the folder but there is no more data about coverage on this folder…I believe.

I think you have fixed this problem. I have other code coverage problems as it does not match with what I have in PHPStorm but …this is another problem. I will try by myself to solve this before creating a new topic.

1 Like

Cool, just create a new thread and we’ll see if we can help you :+1:

1 Like

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