Wednesday, August 13, 2008

Java static code tools : PMD review

PMD - ( Project Mess Detector?)

PMD scans Java source code and looks for potential problems like:
  • Possible bugs - empty try/catch/finally/switch statements
  • Dead code - unused local variables, parameters and private methods
  • Suboptimal code - wasteful String/StringBuffer usage
  • Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
  • Duplicate code - copied/pasted code means copied/pasted bugs.
Release used: 2008-05-20 PMD 4.2.2

Eclipse PMD plugin installation was straight-forward:
  • Select "Help"->"Software Updates"->"Find and Install"
  • Click "Next", then click "New remote site"
  • Enter "PMD" into the Name field and "http://pmd.sf.net/eclipse" into the URL field
  • Click through the rest of the dialog boxes to install the plugin
Worth to mention that PMD has support of almost all java IDE's are available on the market today, you could run it as ANT task and most important that all rules could be customized with PMD rule designer.
To run you just need right click on your source tree node and to choose "PMD/Check code with PMD".


Well thought to quit coding after FindBugs found about 300 bugs, but 2625 ... In PMD perspective view you could filter a found bugs by importans, it's about five categories. To generate HTML just right-click on project PMD/Generate reports.
Repors are have very simple view. all issues are not sorted by any criteria, so it make a very difficult to view about 2000 issues and to find a really something important to fix.



Conclusions: If you want to follow all java notations and standarts, write one of your own this tool is could be very usefull.

4 comments:

danlighter said...

Nice blog... it is crucial to additionally use tools of tools for static code review and to make software more dependable and reliable.

Skein Tech said...

Thanks for sharing Information to us. If someone wants to know about,I think this is the right place for you!

mobile app development in coimbatore
mobile app development company in atlanta
3d animation company

Melinda Mullen said...

xzc

Rodney Janis said...

Hello, this is fastidious post I actually loved reading this.
UI design firms