我正在为Eclipse(Eclipse Kepler Java EE)使用PMD插件(版本4.0.2)。我已经配置了一个命名规则:ShortVariable。如何在使用PMD的短变量规则中忽略“id”
这工作正常,除了参数如"id"
和"e"
。我希望PMD忽略这些。所以我搜索了一种方法来忽略某些参数。我发现this link(虽然它是为phpmd)并尝试过,但我似乎无法得到它的工作。我的配置文件看起来像这样(XML):
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<property name="exceptions" value="id" />
</rule>
</ruleset>
当我尝试导入使用Eclipse插件,这个规则集,它没有显示出可能的规则导入。 任何想法?
[找到解决方案](http://zavyn.blogspot.be/2011/09/solution-modify-pmds-shortvariable-rule.htm l)(也许不是最大的)经过一番搜索。 – SanderDN
您的链接解决方案非常好!请将其张贴为答案,并在宽限期后接受。谢谢。 –