Disable rule in sonar

此生再无相见时 提交于 2019-12-18 03:51:26

问题


I want to disable a rule from Sonar so it doesn't show the results in the web page. In my case I want to hide (or not capture) the results about trailing comments.

Is it posible to configure it somewhere?

Thanks.


回答1:


You have to remove this rule in the quality profile that you are using to analyse your project.

Please refer to the documentation that describes all this: Quality Profiles in Sonar.




回答2:


The right way to do is to put something like this on sonar-project.properties file per project:

sonar.issue.ignore.multicriteria=e1,e2
# tab characters should not be used
sonar.issue.ignore.multicriteria.e1.ruleKey=squid:S00105
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.java
# right curly braces should be on a new line
sonar.issue.ignore.multicriteria.e2.ruleKey=squid:RightCurlyBraceStartLineCheck
sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.java



回答3:


In web interface for particular rule just press Deactivate button:




回答4:


Adding to @Vladmir's answer in a new answer as I am not able to comment. You can not modify the built-in profiles. If you don't see the option of Deavtivate, then copy the profile and set it as default. Now you will see the options to activate/deactivate.



来源:https://stackoverflow.com/questions/16399311/disable-rule-in-sonar

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