Nings
Nings

Reputation: 385

SonarQube won't analyze C# project named Test*

I have a project called TestCommander, it is not a test project but instead a product that helps people within the organization to write integration tests easier.

Obviously I want to analyze this C# code. But as it is now it seem to be ignored by SonarQube since it is named Test*, correctly assessed?

Structure is like this:

CompanyName.TestCommander
    - Commands
        - HttpGetCommand.cs
        - ...
    - TestScanner.cs
    - TestRunner.cs
    - CompanyName.TestCommander.csproj

What I have done:

None of these have worked.

My setup: Internal SonarQube 6.7 Automated build in TFS 2017.3 with the VSTS task versioned 3.0.2

Upvotes: 2

Views: 2290

Answers (1)

Val
Val

Reputation: 2080

The projects that have "Test" in their name are considered test projects (e.g. containing only tests) and their analysis results are not pushed to SonarQube. You could try adding /d:sonar.msbuild.testProjectPattern=<pattern> to the list of the arguments to SonarQube.Scanner.MSBuild.exe begin, or in your case to Advanced / Additional Settings, where <pattern> is a .NET regex pattern that will match your test projects' names, but not your main project.

We will change this behavior in the near future, because we would like to push analysis results of tests to SonarQube, but still, by default projects with Test in their name will most probably be considered as test projects and some rules will behave differently.

Upvotes: 2

Related Questions