violationSuppressRegex
is a new property in PMD 5.0. And Sonar uses PMD 4.3.
Looks like I'll have to wait until Sonar upgrades PMD :-(
Question
PMD allows suppressing violations with the violationSuppressRegex
property. See PMD documentation Violation Suppress Regex.
For example for the LooseCoupling Rule.
Is there any way to use this functionality in Sonar?
Example
Suppress Loose Coupling violation for LinkedHashSet in PMD:
<rule ref="rulesets/coupling.xml/LooseCoupoing">
<property name="violationSuppressRegex" value=".*'LinkedHashSet'.*"/>
</rule>
Where the violation message is something like:
You should not use 'LinkedHashSet' but an interface.
Solution
violationSuppressRegex
is a new property in PMD 5.0. And Sonar uses PMD 4.3.
Looks like I'll have to wait until Sonar upgrades PMD :-(
OTHER TIPS
You might want to have a look at http://docs.codehaus.org/display/SONAR/Switch+Off+Violations+Plugin