Why PMD?
PMD identifies potential problems in the code like:
http://pmd.sourceforge.net/
http://www.javagyan.com/
For Java developers it is good opportunity to check whether they are following standard
programming principles? For most Java development projects going on
these days the answer would be to use "PMD". Basically PMD is Programming Mistake Detector. There are a lot many tools that PMD competes with i.e Checkstyle,
FindBugs, Hammurapi, Soot, Squale etc.
- 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
Configuring PMD for Eclipse
Quickly configure it with your Eclipse installation.- Start Eclipse.
- Select the Help>Software Updates>Find and Install... menu item.
- Select "Search for new features to install" option and click Next.
- Click New Remote Site...
- Enter the URL http://pmd.sourceforge.net/eclipse
- Select this new site in the Sites to include in search list and click Next.
- Select PMD for Eclipse 3 and Apache Xerces in the "Select the features to install" list and click Next.
- Accept the terms of the license agreements and click Next.
- Verify that the install location is your Eclipse installation directory, otherwise select the correct one, click Finish.
- A warning appear telling the feature is not signed. Ignore and click Install to continue.
- Accept to restart the workbench to load PMD into the workbench.
- Right click on java file and try to check code using PMD.
Source
http://pmd.sourceforge.net/
http://www.javagyan.com/
R & D Department zindabad... nice article..will Try Out .
ReplyDelete