Dave Corley has integrated some clever Javascript folding into the PMD XML report! You can see a demo of it here - it's sorted by number of problems per source file, and you can expand/collapse the report for the problems found in the individual files.
The nice part of this is that it's just an XSLT stylesheet linked to the report - so the first two lines of the PMD XML report file look like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="pmd_report.xslt"?>
And then all the work is done in the stylesheet. Nice work, Dave!
Note that this is based on Javascript written by Christian Heilmann.
Support PMD! Get the book - PMD Applied!
This is a *very* nifty report style. I like the collapsing boxes and the summary at the top. I could see this sitting on a master dashboard display somewhere along with the open bug count, the build status, and other helpful info.
I seem to remember saying something along these lines last week: "Of course, if you wanted to add more information or color code the different types of rule-breakages, this would be useful to provide a quick summary of things that need particular attention." ;)
Errors out in FF 1.0, but works fine in IE6.0. Maybe I should just upgrade FF...
Posted by: Keith Casey | December 14, 2005 at 09:30 AM
Yup, it's a cool piece of work. FWIW, it works for me in FF 1.5 (which also has drag and drop tabs, which are quite nice).
Posted by: tomcopeland | December 14, 2005 at 09:35 AM
And as an experiment, I attempted to use PMD on a extensive set of JSP files.
The results are mixed... somethings like unused variable work pretty well, but other things - like handling try/catch and many flow control things - seem to confuse PMD once the jsp's are pre-compiled. A useful experiment regardless.
Posted by: Keith Casey | December 14, 2005 at 09:36 AM
I think PMD would be most useful for JSPs if you could run it before the JSP was compiled. When running it after compilation, you end up finding problems in the JSP compiler, not in your code :-)
But we'd need a JavaCC grammar for JSP to do that - a big job, that.
Posted by: tomcopeland | December 14, 2005 at 09:48 AM
Very good. I like the fact that it puts the "degree of fault" in the picture. I don't know if the PMD report already did that (I use Maven 1 plugin), but that is major advantage. You can quickly get an overview of what needs fixing badly and what is less worse.
Wim
PS: I do really hate the colors used, but it's a very good idea to start with anyway.
Posted by: Wim Deblauwe | December 14, 2005 at 11:42 AM