diff --git a/pmd/xdocs/suppressing.xml b/pmd/xdocs/suppressing.xml index b46f76adbb..c9763c3c0c 100644 --- a/pmd/xdocs/suppressing.xml +++ b/pmd/xdocs/suppressing.xml @@ -44,7 +44,23 @@ No problems found! UnusedLocalVariable rule violation suppressed by //NOPMD in /home/tom/pmd/pmd/bin/Foo.java -

There's an additional note on NOPMD usage here

+

Note that PMD expects the //NOPMD marker to be on the same line as the violation. So, for + example, if you want to suppress an "empty if statement" warning, you'll need to place it on + the line containing the "if" keyword, e.g.:

+ +$ cat ~/tmp/Foo.java +public class Foo { + void bar() { + int x = 42; + if (x > 5) { // NOPMD + } + } +} + +$ java net.sourceforge.pmd.PMD ~/tmp/Foo.java text basic +No problems found! +$ +

Suggestions? Comments? Post them here. Thanks!