pmd: update rule-guidelines to changed package names

This commit is contained in:
Andreas Dangel
2013-01-26 10:38:58 +01:00
parent ffac9894c9
commit 55b5aa7f27

View File

@ -56,17 +56,17 @@ to Jaxen overhead for AST navigation. Make sure your XPath rules using the Rule
</section> </section>
<section name="Adding test cases ..."> <section name="Adding test cases ...">
<subsection name="... for a rule I want to submit (in a patch)"> <subsection name="... for a rule I want to submit (in a patch)">
<p>In the regress directory, you'll find all the unit tests for PMD. In the <p>In the test directory (src/test/java), you'll find all the unit tests for PMD. In the
proper package (for instance, test.net.sourceforge.pmd.rules.basic, for proper package (for instance, net.sourceforge.pmd.lang.java.rule.basic, for
rules from the basic rulesets), you'll find a test suite such as this :</p> rules from the basic rulesets), you'll find a test suite such as this :</p>
<source><![CDATA[ <source><![CDATA[
public class BasicRulesTest extends SimpleAggregatorTst { public class BasicRulesTest extends SimpleAggregatorTst {
@Before @Before
public void setUp() { public void setUp() {
addRule("basic", "AvoidDecimalLiteralsInBigDecimalConstructor"); addRule("java-basic", "AvoidDecimalLiteralsInBigDecimalConstructor");
addRule("basic", "AvoidMultipleUnaryOperators"); addRule("java-basic", "AvoidMultipleUnaryOperators");
addRule("basic", "AvoidThreadGroup"); addRule("java-basic", "AvoidThreadGroup");
... ...
]]></source> ]]></source>
<p>Suppose you want to add tests for a new rule of yours, called "MyNewRule". <p>Suppose you want to add tests for a new rule of yours, called "MyNewRule".
@ -74,12 +74,12 @@ public class BasicRulesTest extends SimpleAggregatorTst {
<source><![CDATA[ <source><![CDATA[
public void setUp() { public void setUp() {
... ...
addRule("basic", "MyNewRule"); addRule("java-basic", "MyNewRule");
... ...
} }
]]></source> ]]></source>
<p>And add in the appropriate xml subpackage (for instance, <p>And add in the appropriate xml subpackage in src/test/resources (for instance,
test.net.sourceforge.pmd.rules.basic.xml). There you should find a XML file net.sourceforge.pmd.lang.java.rule.basic.xml). There you should find a XML file
for each rule, the syntax is pretty obvious:</p> for each rule, the syntax is pretty obvious:</p>
<source><![CDATA[ <source><![CDATA[
<test-data> <test-data>
@ -109,7 +109,7 @@ package too.specific.to.submit;
import org.junit.Before; import org.junit.Before;
import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
public class SpecificRulesTest extends SimpleAggregatorTst { public class SpecificRulesTest extends SimpleAggregatorTst {
@ -140,7 +140,8 @@ If you want to contribute a java rule to PMD, you should run PMD on it (Using th
<section name="Committing"> <section name="Committing">
<p> <p>
Before committing changes, make sure the 'qa' target in the Ant build works. Drink a beer while you wait for it to finish. Before committing changes, make sure the verify phase of a maven build succeeds without test failures.
Drink a beer while you wait for it to finish.
Then read the output to make sure no fatal errors are present. Then read the output to make sure no fatal errors are present.
</p> </p>
</section> </section>