SonarQube MSBuild runner fails on deactivated rule

允我心安 提交于 2019-12-25 07:53:14

问题


SonarQube MSBuild runner fails if I deactivate FxCop rule in quality profile:

Unable to find the rule key corresponding to the rule config key 'CA1305' in in repository "fxcop".

I've bulk-added all the fxcop rules. 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.


回答1:


I suspect that you are somehow importing an FxCop report that contains CA1305 issues after you disabled the rule in your repository.

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

Could you try:

  1. Disable the CA1305 rule in your quality profile
  2. Run: 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
  2. You can find the location to the FxCop report in .sonarqube\out\*\ProjectInfo.xml - look for the <AnalysisResult Id="FxCop" Location="..."
  3. Within that report, there is no occurence of CA1305


来源:https://stackoverflow.com/questions/33128920/sonarqube-msbuild-runner-fails-on-deactivated-rule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!