There’s a new project on Adobe Open Source called FlexPMD (if You’re wondering what PMD stands for the answer is simple – nothing). It’s a tool that scans Actionsript and MXML code and points out bad practices, unused variables, etc. Really helpfull if you’re trying to keep the code clean and get a habit of  coding really nicely.

To try it out you really just need to go to the download page, get one of the versions (I’ve tested the command line one on windows and it works very good), generete a ruleset file using the web tool (link on the same page), and that analize the output XML file (you can use the simple web tool which is also provided on the download page).

I’ve put both the jar files and the ruleset (called pmd.xml) in “F:/Flex SDK/Tools/FlexPMD/” so the command to run it for me looks like this:

java -Xmx256m -jar “F:/Flex SDK/Tools/FlexPMD/flex-pmd-command-line-1.0.RC3.jar” -s “F:/THE/DIRECTORY/WHICH/TO/ANALIZE/” -o . -r “F:/Flex SDK/Tools/FlexPMD/pmd.xml”

It might be good to point out that you don’t need to analize the whole project but can also run the tool on any directory in it, which generates files which are easier to read, especially if you’re just starting to clean a big application.