1

I'm running sonar on my NetCore solution and trying to exclude the following
- .Service, .UnitTests and .Contract projects from code coverage
- .UnitTests projects from code analysis

Seems that SonarQube does a good job at excluding tests, but I can't find a way to exclude the other two project types from code coverage...
There's this question that's fairly similar but I'm interested in a solution that doesn't require going into SonarQube UI and/or the .csproj files. (to keep things in one place)

I have sonarscanner installed, and use the /d:sonar.coverage.exclusions option, but that doesn't seem to take projects into account. If I exclude UsersController.cs for example, it will be excluded from all projects, not just the .Service projects.
/d:sonar.coverage.exclusions="Controllers/UsersController.cs" excluded the file, but /d:sonar.coverage.exclusions="WebApi.Service/Controllers/UsersController.cs" did not, (since the filtering is done per project, and it doesn't know about the "WebApi.Service" path, just the files it contains)

norb
  • 165
  • 2
  • 11
  • I use UI, but as you I would like have explicit configuration for the solution. Don't work for me, but I see severy time this answer exposed "/d:sonar.coverage.exclusions=file:**//**". The 'file' word is to applicate the partern on absolute path. – vernou Jun 06 '19 at 07:59

0 Answers0