From 0cbdd8acf89169a130799a7e047c992542cec756 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Thu, 25 May 2006 02:37:06 +0000 Subject: [PATCH] Inlined a note about a NOPMD sublety git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4389 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/xdocs/suppressing.xml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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!