In SonarQube runner, it was possible to manage excluded projects through the sonar.exclusions property in the sonar project properties. This way we could manage build configuration separate from the code base.
We're migrating from the runner to scanner for MSBuild to take advantage of running FXCop rules on our code.
Leaving the sonar-project.properties file in the root folder of the project results in an exception in the "MSBuild.SonarQube.Runner.exe end" command. sonar-project.properties files are not understood by the SonarQube Scanner for MSBuild. Remove those files from the following folders: [folder]
The only option I can see now for excluding specific projects (actually all projects which name ends with .Test, .Tests, .Testing, .UnitTests, etc) appears to be adding a project property to a propertyGroup in each affected project: <SonarQubeExclude>true</SonarQubeExclude>
This is hard to maintain, error prone and cumbersome, compared to managing the settings on root level (which we did for jenkins) or in the build settings (which we currently use in TeamCity).
Is there any alternative? Or planned for the future?
When the project folder is called ***.Tests, it is still scanned after adding it to the the exclusion settings.
[14:14:14][Step 12/23] INFO: ------------- Scan MyProject.Tests
[14:14:14][Step 12/23] INFO: Excluded sources for coverage:
[14:14:14][Step 12/23] INFO: **/*.Tests/**/*
[14:14:14][Step 12/23] INFO: **/*.Test/**/*
[14:14:14][Step 12/23] INFO: Base dir: C:\SomeFolder\MyProject\Modules\MyProject.Tests
[14:14:14][Step 12/23] INFO: Working dir: C:\SomeFolder\MyProject\.sonarqube\out\.sonar\{Sonar_Project}_{some guid}
[14:14:14][Step 12/23] INFO: Test paths: [I removed some classes], Utils/SomeTests.cs, Enum/dummy.resx, app.config, Compression/TestData/data1.FRM, Compression/TestData/data1.zip, Compression/TestData/data1.Off.zip, packages.config
[14:14:14][Step 12/23] INFO: Source encoding: UTF-8, default locale: en_US
[14:14:14][Step 12/23] INFO: Index files
[14:14:15][Step 12/23] INFO: 45 files indexed
[14:14:15][Step 12/23] INFO: Quality profile for cs: [some profile]
[14:14:15][Step 12/23] INFO: Quality profile for vb: [some profile]