0

I am using SonarQube 5.0, together with the C# plugin (3.3), StyleCop Plugin (1.1) and Analysis Bootstrapper for Visual Studio Projects Plugin (1.2).

On the documentation page for the Analysis Bootstrapper for Visual Studio, it is stated that unit test code will not be analyzed. But I would like to treat the test code with the same care we treat production code.

I have found this related question, where it says that this is not supported, but I think that this might have changed from 2012.

I have also found this closed SonarQube task, which states that FxCop and StyleCop should analyze unit tests, but duplication detection does not work.

My question is:

Can I analyze test code (FxCop, StyleCop, complexity, duplication) using the Visual Studio Bootstrapper. If not, can I do it if I don't use the bootstrapper?

Community
  • 1
  • 1
victorc
  • 3
  • 2

1 Answers1

2

Analyzing test code is still not supported.

However, you can tell Visual Studio Bootstrapper plugin to consider all code as production code, by setting sonar.visualstudio.testProjectPattern to not match anything - but this is a workaround. All the code will then be analyzed in the exact same way.

Dinesh Bolkensteyn
  • 2,971
  • 1
  • 17
  • 20