In the Eclipe PMD plugin, can I reference the standard ruleset files?

≡放荡痞女 提交于 2019-12-05 12:53:04

You can include other rulesets in a PMD ruleset file, e.g.

<ruleset ...>
    ...
    <rule ref="rulesets/basic.xml"/>
    ...
    <rule ref="rulesets/strings.xml">
        <exclude name="AvoidDuplicateLiterals"/>
    </rule>
    ...
</ruleset>

This is actually an excerpt from our own ruleset file, so it is proven to work :-)

As you can see, you can exclude/include individual rules from your ruleset, or even reconfigure them. One caveat: you must not mix rules for different languages in a single ruleset. I.e. in our case, we had to create separate rulesets for Java and JSP.

I learned the tricks myself from this page.

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