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)