SonarQube C# SuppressMessage, Category for S1871

5.5k Views Asked by At

I'm trying to use the System.Diagnostics.CodeAnalysis.SuppressMessage attribute to stop sonarqube raising this issue on a specific method in our codebase. I'm not sure exactly what form the suppress message attribute should take. I have tried a few variations on the following with no luck.

[SuppressMessage("csharpsquid", "S1871:Two branches in the same conditional structure should not have exactly the same implementation")]
public static string SomeMethod(string input)

Here is the link to the documentation for the issue: http://dist.sonarsource.com/plugins/csharp/rulesdoc/0.9.0-RC/S1871.html

Using: sonar-csharp-plugin-5.3.2

1

There are 1 best solutions below

2
Tamas On BEST ANSWER

The SonarQube C# plugin version 5.4.0.464 fixes this issue. Have a look at this ticket: https://jira.sonarsource.com/browse/SONARCS-613