PMD PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks, unnecessary object creation, and so forth. It supports Java, JavaScript, XML, XSL. Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in Java, C, C++, C#, PHP, Ruby, Fortran, JavaScript. System requirements
Installing PMD Download pmd-bin-5.3.7.zip (29,0Mb). Also download the manual pmd-doc-5.3.7.zip (47,0Mb!). Create a folder (directory) "pmd537" or "pmd". Unzip the zip files to the subdirectory. That's it. Version 5.4.0 and up needs Java version 1.7 or better. Version 5.3.7 is released at April 30, 2016, so by no means dated!, see the PMD Web Site The cmd files This is not a program with some nice graphical user interface. Its more command line oriented. So there is not a real "fix it all" command file. I give an example with the following contents; @echo off set BEGINLIBPATH=[drive: java]\JAVA160\bin set path=[drive: java]\JAVA160\bin set CLASSPATH= rem set OPTS= [drive: pmd] cd [drive: pmd]\pmd537 java -Duser.home=[drive: pmd]\pmd537 -classpath [drive: pmd]\pmd537\lib\* net.sourceforge.pmd.PMD -d [drive: greenfoot]\Greenfoot\scenarios\lunarlander\Lander.java -rulesets java-basic,java-design 2>pmd537-bugs.txtThere is a space between "net.sourceforge.pmd.PMD" and "-d [drive: greenfoot]\..." and between "java-basic,java-design" and "2>pmd537-bugs.txt". Sometimes its handy to add ">results-pmd.txt" before "2>pmd537-bugs.txt", in this way the comments in the command session are saved when its more than will fit into a 80x25 screen. The developer version of Java is on the same drive as PMD, only different folders (directories), one for Java, one for PMD and one for Greenfoot. Greenfoot is in test and there is something wrong with their Lunar module game, it crashes whatever you do. The references used in the cmd file;
should be replaced with real drive letters. Edit and save the file with a name of your choice or use the file from the distribution. This file is copied to the "pmd" folder (directory). Furthermore, different paths?, adjust according to your needs. There are in the "\bin" map/directory a few "*.bat" files and a Linux sh file. The bat files are for Windows, but they are a nice start. You need to add parameters before executing the batch files. Without you get lots of errors. I only rebuild the "pmd.bat" file and this file is in the download file. I did try some others and didn't get errors in the bug file. Parameters / options explained
Download In the file you can find the above command file (all driveletters are set to C:), the helpfile as text file and a PMD icon: pmd-ecs.zip. revision May 22, 2016 |