Here’s a small snippet of check style being run on Apache Tomcat’s source.  Unfortunately, the project does not come with any XSLT renderers. However, the output can be directed into an XML file and a custom renderer could be made.

 

Final Thoughts

Arguably, PMD, FindBugs, and Checkstyle are the most popular open-source Java code analyzers out there today. There is a good amount of overlap between them, but each provides a unique service. The ideal static code analyzer would combine PMD, FindBugs, and Checkstyle, so all aspects of coding practice could be covered.

One open-source project bears mentioning – Sonar.  Without any heavy experimenting, Sonar wraps PMD, FindBugs, and Checkstyle into one package, plus more. A big drawback to Sonar is that it requires a database and hosting on a web server. PMD, FindBugs, and Checkstyle can be downloaded and running on source code in less than five minutes.

Regardless of what software package is used, running a static code analyzer is a great idea for java projects. Not only do they enforce project-wide coding standards, but they help prevent buggy code from reaching a critical environment. Best of all, some of the best java source code analyzers are open source.