简体   繁体   English

SonarQube MSBuild运行器因禁用规则而失败

[英]SonarQube MSBuild runner fails on deactivated rule

SonarQube MSBuild runner fails if I deactivate FxCop rule in quality profile: 如果我停用质量配置文件中的FxCop规则,SonarQube MSBuild运行器将失败:

Unable to find the rule key corresponding to the rule config key 'CA1305' in in repository "fxcop". 在存储库“ fxcop”中找不到与规则配置密钥“ CA1305”相对应的规则密钥。

I've bulk-added all the fxcop rules. 我已经批量添加了所有fxcop规则。 Added a project. 添加了一个项目。 Then then deactivated some rules in quality profile and tried to analyze new project. 然后停用质量配置文件中的一些规则,并尝试分析项目。 Even there was NOT any violations of this rule in code - runner still fails with this weird error. 即使代码中没有任何违反此规则的情况-运行程序仍然会因此奇怪的错误而失败。

I suspect that you are somehow importing an FxCop report that contains CA1305 issues after you disabled the rule in your repository. 我怀疑您在禁用存储库中的规则后以某种方式导入了包含CA1305问题的FxCop报告。

The error message you see is being generated here, and this method is only called during the parsing of the FxCop report: https://github.com/SonarCommunity/sonar-fxcop-library/blob/1.3/src/main/java/org/sonar/plugins/fxcop/FxCopSensor.java#L179 您在此处生成的错误消息正在生成,并且仅在FxCop报告解析期间调用此方法: https : //github.com/SonarCommunity/sonar-fxcop-library/blob/1.3/src/main/java/ org / sonar / plugins / fxcop / FxCopSensor.java#L179

Could you try: 您可以尝试:

  1. Disable the CA1305 rule in your quality profile 在您的质量配置文件中禁用CA1305规则
  2. Run: MSBuild.SonarQube.Runner begin /k:... /n:... /v:... 运行: MSBuild.SonarQube.Runner begin /k:... /n:... /v:...
  3. msbuild /t:rebuild
  4. MSBuild.SonarQube.Runner end

Then, could you verify that: 然后,您可以验证一下:

  1. In the generated file .sonarqube\\conf\\SonarQubeFxCop-cs.ruleset , you don't see an entry for CA1305 在生成的文件.sonarqube\\conf\\SonarQubeFxCop-cs.ruleset ,您看不到CA1305的条目。
  2. You can find the location to the FxCop report in .sonarqube\\out\\*\\ProjectInfo.xml - look for the <AnalysisResult Id="FxCop" Location="..." 您可以在.sonarqube\\out\\*\\ProjectInfo.xml找到FxCop报告的位置-查找<AnalysisResult Id="FxCop" Location="..."
  3. Within that report, there is no occurence of CA1305 在该报告中,没有发生CA1305

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM