How to disable Sonar rules for specific files?

后端 未结 6 781
囚心锁ツ
囚心锁ツ 2021-01-03 21:35

I\'ve got a project I\'m working on and some of the files violate some of the rules, but in ways that are not real issues, and are thus distracting noise. However, I don\'t

6条回答
  •  梦毁少年i
    2021-01-03 22:02

    You can set specific files and rules under sonar-project.properties with following contents:

    # Ignore Issues
    sonar.issue.ignore.multicriteria=e1,e2
    # Skip Bold Check
    sonar.issue.ignore.multicriteria.e1.ruleKey=Web:BoldCheck
    sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.html
    # Skip Tag Check
    sonar.issue.ignore.multicriteria.e2.ruleKey=Web:S1234
    sonar.issue.ignore.multicriteria.e2.resourceKey=**/*.html
    

    Change the ruleKey and resourceKey based on your specific need.

提交回复
热议问题