SonarQube C# SuppressMessage, Category for S1871

本文关键字:for S1871 Category SuppressMessage SonarQube | 更新日期: 2023-09-27 18:15:40

我试图使用System.Diagnostics.CodeAnalysis.SuppressMessage属性来阻止sonarqube在我们的代码库中对特定方法提出此问题。我不确定压制消息属性应该采取什么形式。我尝试了以下几种变体,但没有运气。

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

这里是这个问题的文档链接:http://dist.sonarsource.com/plugins/csharp/rulesdoc/0.9.0-RC/S1871.html

使用:sonar-csharp-plugin-5.3.2

SonarQube C# SuppressMessage, Category for S1871

SonarQube c#插件版本5.4.0.464修复了此问题。看看这张票:https://jira.sonarsource.com/browse/SONARCS-613