我在SonarQube 5.4中使用了MSBuild 2.0的SonarQube扫描仪。我已经为Roslyn Wintellect.Analyzers NuGet软件包添加了SonarQube插件到SonarQube服务器,并将规则添加到我的SonarQube项目使用的质量配置文件中。在C#源代码中,我已经使用#pragma禁用了“Wintellect003”规则(然后我尝试了SuppressMessage属性内嵌然后在GlobalSuppressions.cs中)。该规则在Visual Studio 2015和msbuild 14中被成功禁用,但SonarQube不尊重我禁用了规则的事实(对于这一行代码 - 我没有禁用SonarQube或规则集中的规则)。SonarQube忽略isSuppressedInSource?
我可以看到,MsBuild.SonarQube.Runner.exe正在识别抑制,因为在“结束”阶段它生成RoslynCA.json文件发送给SonarQube,它包括以下部分: -
"ruleId": "Wintellect003",
"kind": "warning",
"locations": [
{
"analysisTarget": [
{
"uri": "file:\/\/\/C:\/CS5Tests/Mycode.cs",
"region": {
"startLine": 920,
"startColumn": 17,
"endLine": 923,
"endColumn": 118
}
}
]
}
],
"shortMessage": "'if' statements must have braces",
"fullMessage": "If and else statements must use braces even for single line results",
"isSuppressedInSource": true,
正如你可以看到它说“isSuppressedInSource”是真的。不幸的是SonarQube不尊重这个设置。有任何想法吗? (我试过停止SonarQube服务器,删除data \ es文件夹来清除缓存并重新启动SonarQube服务器,但这没有帮助)。
谢谢,Mike,将C#插件升级到5.2 RC1确实解决了我的问题。 –
没问题。乐意效劳。如果您不介意,请将此答案标记为已接受。 –