After two months of work, PMD 3.6 is out the door! The most interesting new feature is support for checking JSP/JSF pages - thanks much to Pieter Vanraemdonck for implementing a grammar and doing lots of integration work. He and Allan Caplan teamed up to write eight rules that take advantage of this new capability; you can see the JSF rule here and the JSP rules here.
There are also five new rules for the current PMD rulesets:
Basic ruleset: AvoidThreadGroup
Design ruleset: UnsynchronizedStaticDateFormatter
Strings ruleset: InefficientEmptyStringCheck, InsufficientStringBufferDeclaration
JUnit ruleset: SimplifyBooleanAssertion
You can see exactly what rules were added in each PMD release now using the "release number" rulesets, e.g.:
$ ./pmd.sh Foo.java text 36 -debug
In JDK 1.4 mode
Loaded rule InsufficientStringBufferDeclaration
Loaded rule IframeMissingSrcAttribute
Loaded rule DontNestJsfInJstlIteration
Loaded rule InefficientEmptyStringCheck
Loaded rule AvoidThreadGroup
Loaded rule UnsynchronizedStaticDateFormatter
Loaded rule NoInlineStyleInformation
Loaded rule SimplifyBooleanAssertion
Loaded rule NoScriptlets
Loaded rule NoJspForward
Loaded rule NoLongScripts
Loaded rule NoClassAttribute
Loaded rule NoHtmlComments
Processing /home/tom/pmd/pmd/bin/Foo.java
Just plug in "35" or "34" to see the new rules for previous releases.
And of course there are many bugfixes and improvements - a memory leak has gone away, the JavaCC-generated parser handles more JDK 1.5 edge cases, UseIndexOfChar now catches more cases, AvoidCallingFinalize was rewritten in Java, and much more. You can see all the details in the changelog, and you can download PMD 3.6 here. Share and Enjoy!
Using PMD? Get the book, "PMD Applied"!
Does JSP support work at all???
Hi there,
I've been giving the new JSP rules in PMD 3.6 a try and I just couldn't make it work.
I wrote a JSP file that should result in a bunch of errors (I actually copied the examples that trigger the rules from the documentation) but to no avail.
I can see that the JSP gets parsed (since the process fails when I make my JSP non-XHTML) and that the rules gets loaded (thanks to the -debug option), but for some reason I always get a no-errors report (using both an ant script and from the command line with the -jsp option).
Is there something I am missing?
Thank you very much,
Dani Palacios, Java developer
Posted by: Dani Palacios | April 11, 2006 at 04:09 AM
Hi Dani -
Hm, I saw your post on the forums... let's discuss there since more folks will see it...
Yours,
Tom
Posted by: tomcopeland | April 11, 2006 at 09:13 AM
For future visitors, you can follow the discussion here:
http://sourceforge.net/forum/message.php?msg_id=3681267
And to summarize, use the -jsponly flag:
=============================
$ ./pmd.sh test.jsp text jsp -jsponly
/home/tom/pmd/pmd/bin/test.jsp:4 Use JSP comments instead of HTML comments
=============================
Posted by: tomcopeland | April 11, 2006 at 10:04 AM
Yes Tom, you're right (I didn't find the PMD forum at first, so I wrongly posted it here). I was going to post a comment here with the URL of the forum:
http://sourceforge.net/forum/forum.php?thread_id=1480655&forum_id=188192
Posted by: Dani Palacios | April 11, 2006 at 12:00 PM
Hi Dani -
No problem! And I hope you'll report any problems you find with the JSP functionality; that's very new code, so there may well be some problems there...
Yours,
Tom
Posted by: tomcopeland | April 11, 2006 at 12:02 PM