Sonar.coverage.exclusions not working

Seems to be similar to both

https://community.sonarsource.com/t/code-coverage-exclusions-dont-work-for-6-7-x-with-c-projects/1025
and
https://community.sonarsource.com/t/class-exclusion-does-not-work/872

I can not get the coverage exclusions to apply to C# projects. We want to analysis code quality of our Unit Test projects, but don’t want to include code coverage (as it will be 0%) and will bring down the overall value against the sonar project. So I mark the Unit Test projects to not be marked as a Test Project in SonarLint (otherwise don’t get any code analysis) and then want to exclude the files from the coverage using sonar.coverage.exclusions parameter. However this doesn’t appear to apply as it suggests it should with the Wildcard examples at the bottom of the administration page.

I’d like to filter out all files under a physical folder, but it appears the code filter doesn’t see the full filename, so have tried filtering by *Tests.cs which should exclude pretty much all files in my test project (isn’t a great filter but better than nothing), but it only appears to apply it to the root file level and not the sub folder files. Using **/*Tests.cs doesn’t exclude anything (root or sub folder level).

So looking for help understanding what the filters should look like, or understanding if this is a bug, and if so if there is any plan to look to fix. Also would be nice to understand what the plan for sonarqube and test projects is or will be. Marking it as a Test Project via SonarLint just seems to fully exclude the project from analysis.

Hi Michael. Could you clarify which modules you have to exclude from coverage? or share with a screenshot from Project page on Sonar? By the way, you can try to use this approach from comment Code coverage exclusions don't work for 6.7.x+ with C# projects

Hi @michaelball

Are you still having this issue?

A post was split to a new topic: Coverage exclusions not working