How to disable Sonar rules for specific files?

user153275 picture user153275 · Jan 14, 2014 · Viewed 38.3k times · Source

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 want to disable these rules globally, and I would prefer not to have to mark 'em as false positives one by one.

Is there a way to disable Sonar rules for specific files, and if so, how?

Answer

Mithfindel picture Mithfindel · Jan 14, 2014

Since SonarQube 4.0, you can define issue exclusion patterns based on rule key and file path pattern.

On previous versions, you can rely upon the Switch Off Violations plugin.