2015-08-18 108 views
0

「假設你想從各種規則集中選擇特定的規則並對其進行自定義,你可以通過制定自己的規則來做到這一點。」將規則引用添加到新規則集的命名約定是什麼?

這句話可以在這裏找到:https://pmd.github.io/pmd-5.3.3/customizing/howtomakearuleset.html

Java的PMD規則集索引中列出了很多規則集。但是我在哪裏可以找到應該在我自己的規則集中使用的ref-tag?

例如:如果我想包括我用下面的REF標籤的「基本」規則集:<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"/>
  • ...

一些建議嗎?謝謝

+0

解決方案:從http://sourceforge.net/projects/pmd/files/pmd/5.3.3/下載最新版本,並看看PMD-java的5.3 .3.jar。您將在rulesets-folder中找到* .xml文件 –

回答

0

該規則集與文件all-java.xml中的PMD一起分發。

下面是它的內容:

<?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>