diff --git a/pmd/xdocs/howtowritearule.xml b/pmd/xdocs/howtowritearule.xml index f60705cc8a..5b2aa3e454 100644 --- a/pmd/xdocs/howtowritearule.xml +++ b/pmd/xdocs/howtowritearule.xml @@ -126,8 +126,8 @@ WhileStatement ]]>

- Ah ha! We see that the curly braces add a couple more AST elements - a Block and a BlockStatement. So all we have - to do is write a rule to detect a WhileStatement that has a Statement that's not followed by a Block, and we've got a rule violation. + Ah ha! We see that the curly braces add a couple more AST elements - a Block and a BlockStatement. So all we have + to do is write a rule to detect a WhileStatement that has a Statement that's not followed by a Block, and we've got a rule violation.

@@ -143,7 +143,7 @@ public class WhileLoopsMustUseBracesRule extends AbstractRule {

That was easy. PMD works by creating the AST and then traverses it recursively so a rule can get a callback - for any type it's interested in. So let's make sure our rule gets called whenever the AST traversal finds a WhileStatement: + for any type it's interested in. So let's make sure our rule gets called whenever the AST traversal finds a WhileStatement:

Now our rule is written - at least, the shell of it is - and now we need to tell PMD about it. We need - to add it to a rule set XML file. Look at rulesets/basic.xml; it's got lots of rule definitions that look like this: + to add it to a rule set XML file. Look at rulesets/basic.xml; it's got lots of rule definitions that look like this:

- We'll just leave this rule in the rulesets/basic.xml ruleset for now. If you write rules for your own - project that aren't applicable to other projects (rules to catch Thread creation, for example, or rules to catch - System.out.println() usages) you might want to make a new ruleset myproject.xml and put your rules in there. + We'll just leave this rule in the rulesets/basic.xml ruleset for now. If you write rules for your own + project that aren't applicable to other projects (rules to catch Thread creation, for example, or rules to catch + System.out.println() usages) you might want to make a new ruleset myproject.xml and put your rules in there.

- Remember when we ran go.bat over the Example.java file? Do it again. This time your "hello world" will show up right after the + Remember when we ran go.bat over the Example.java? Do it again. This time your "hello world" will show up right after the AST gets printed out. If it doesn't, post a message to the forum so we can improve this document :-)