There are many open source tools that can help identify poor coding practices.
In the Java world, three static analysis tools have stood the test of time, and are widely used in very complementary ways. Checkstyle excels at checking coding standards and conventions, coding practices, as well as other metrics such code complexity. PMD is a static analysis tool similar to Checkstyle, more focused on coding and design practices. And FindBugs is an innovative tool issued from the ongoing research work of Bill Pugh and his team at the University of Maryland that focuses on identifying potentially dangerous and buggy code. And if you are working with Groovy or Grails, you can use CodeNarc, which checks Groovy coding practices and convention.
All of these tools can be easily integrated into your build process. In the following sections, we will look at how to set up these tools to generate the XML reports that Jenkins can then use for its own reporting.
Checkstyle is a static analysis tool for Java. Originally designed to enforce a set of highly-configurable coding standards, Checkstyle now also lets you check for poor coding practices, as well as overly complex and duplicated code. Checkstyle is a versatile and flexible tool that should have its place in any Java-based code quality analysis strategy.
Checkstyle supports a very large number of rules, including ones relating to naming conventions, annotations, javadoc comments, class ...