将规则引用添加到新规则集的命名约定是什么?

时间:2015-08-18 12:45:37

标签: pmd

“假设您要从各种规则集中选择特定规则并对其进行自定义。您可以通过制定自己的规则集来实现此目的。”

这句话可以在这里找到:https://pmd.github.io/pmd-5.3.3/customizing/howtomakearuleset.html

java的PMD Rulesets索引列出了许多规则集。但是我在哪里可以找到应该在我自己的规则集中使用的ref-tag?

例如:如果我想要包含“基本”规则集,请使用以下引用标记:<rule ref="rulesets/java/basic.xml"/>

但是,如果我想加入“克隆实施”,我必须选择什么?是吗:

  • <rule ref="rulesets/java/cloneimplementation.xml"/>
  • <rule ref="rulesets/java/clone_implementation.xml"/>
  • <rule ref="rulesets/java/CloneImplementation.xml"/>
  • ...

一些建议?感谢

1 个答案:

答案 0 :(得分:0)

规则集与PMD一起分发在文件all-java.xml中。

以下是其内容:

<?xml version="1.0"?>

<ruleset name="All Java Rules" 
    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>Every Java Rule in PMD</description>

    <rule ref="rulesets/java/android.xml"/>
    <rule ref="rulesets/java/basic.xml"/>
    <rule ref="rulesets/java/braces.xml"/>
    <rule ref="rulesets/java/clone.xml"/>
    <rule ref="rulesets/java/codesize.xml"/>
    <rule ref="rulesets/java/comments.xml"/>
    <rule ref="rulesets/java/controversial.xml"/>
    <rule ref="rulesets/java/coupling.xml"/>
    <rule ref="rulesets/java/design.xml"/>
    <rule ref="rulesets/java/empty.xml"/>
    <rule ref="rulesets/java/finalizers.xml"/>
    <rule ref="rulesets/java/imports.xml"/>
    <rule ref="rulesets/java/j2ee.xml"/>
    <rule ref="rulesets/java/javabeans.xml"/>
    <rule ref="rulesets/java/junit.xml"/>
    <rule ref="rulesets/java/logging-jakarta-commons.xml"/>
    <rule ref="rulesets/java/logging-java.xml"/>
    <rule ref="rulesets/java/migrating.xml"/>
    <rule ref="rulesets/java/naming.xml"/>
    <rule ref="rulesets/java/optimizations.xml"/>
    <rule ref="rulesets/java/strictexception.xml"/>
    <rule ref="rulesets/java/strings.xml"/>
    <rule ref="rulesets/java/sunsecure.xml"/>
    <rule ref="rulesets/java/typeresolution.xml"/>
    <rule ref="rulesets/java/unnecessary.xml"/>
    <rule ref="rulesets/java/unusedcode.xml"/>
</ruleset>