2013-10-07 49 views
0

PMD允許用violationSuppressRegex屬性來抑制違規。請參閱PMD文檔Violation Suppress Regex如何在Sonar上使用PMD violationSuppressRegex?

例如對於LooseCoupling Rule

有什麼辦法可以在Sonar中使用這個功能嗎?

禁止鬆耦合違規LinkedHashSet在PMD:

<rule ref="rulesets/coupling.xml/LooseCoupoing"> 
    <property name="violationSuppressRegex" value=".*'LinkedHashSet'.*"/> 
</rule> 

凡違反消息是這樣的:

You should not use 'LinkedHashSet' but an interface. 

回答

1

violationSuppressRegex是PMD 5.0中的一個新屬性。 Sonar使用PMD 4.3。

看起來像我將不得不等待until Sonar upgrades PMD :-(

相關問題