Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable SonarLint for test projects

I installed SonarLint in VS 2015 and it looks like a great extension with lots of potential.

At the moment the extension is also analysing my test projects and giving warnings about this. How can I disable inspection of specific (test) projects?

Update Its not about disabling specific Sonar rules or projects in SonarQube, but its about the Visual Studio extension SonarLint.

like image 524
Niek Jannink Avatar asked Aug 17 '15 07:08

Niek Jannink


1 Answers

In Visual Studio, open the project and then dig into the Reference section. There choose to edit the active rule set:

Open Active Ruleset

In the screen that opens select/deselect the rules you want for the specific project. Then hit save. This will most likely create a new .ruleset file in your project and instruct Roslyn to use that instead of the standard set.

The result is that the project file is updated with the <CodeAnalysisRuleSet> tag like this:

<CodeAnalysisRuleSet>UnitTests.Core.ruleset</CodeAnalysisRuleSet>

You can also use the add new file wizard and pick the "Code Analysis Rule set" option:

enter image description here

Then from the Analyze menu select "Configure Code Analysis for Solution", your newly added rule set can be selected from there and assigned to the project you want:

enter image description here

like image 129
jessehouwing Avatar answered Sep 20 '22 16:09

jessehouwing