diff --git a/pmd/xdocs/howtowritearule.xml b/pmd/xdocs/howtowritearule.xml index cb68b62675..b8908de3d7 100644 --- a/pmd/xdocs/howtowritearule.xml +++ b/pmd/xdocs/howtowritearule.xml @@ -9,15 +9,20 @@
Writing PMD rules is cool because you don't have to wait for us to get around to implementing feature requests.
- ++ In order to do rules, it'll help if you can modify the PMD source. + So download the latest source release (i.e., pmd-src-0.7.zip or something) and unzip it somewhere on your computer. +
+- First, figure out what you're looking for. Let's use "While loops must use braces" as an example. + Now lets's figure out what problem you want to spot. Let's use "While loops must use braces" as an example. You've seen this before a thousand times so you know what it looks like:
++ So we know what an example in source code looks like, which is half the battle. +
- PMD uses a JJTree/JavaCC generated parser to parse the source code and produce an AST (Abstract Syntax Tree). - This means that the code above looks like this: + PMD doesn't use the source code directly; it uses a JJTree/JavaCC generated parser to parse the source code and + produce an AST (Abstract Syntax Tree). The AST for the code above looks like this:
++ You can generate this yourself by: +
net.sourceforge.pmd.PMD
and uncomment the line that says c.dump();
ant compile
go
batch file to run PMD on one file, like this: go Example xml rulesets/basic.xml
. The go.bat file
+ will fill in the directories and main class and whatnot.
+ You'll probably have to edit this batch file to match where you unzipped PMD.