Flex PMD - improve your code quality

I recently started to look into the Flex PMD open source project. It's supposed to help you analyze your Flex/AS3 code and help you see coding issues that may need to be fixed.

You can either just use the default ruleset for analyzing your code or create your own custom ruleset. There's an editor you can use to view the default ruleset which also describes each rule and shows examples of a code snippet which would cause it to be applied. You can also change the severity you want to apply when you run Flex PMD or remove rules you don't want to include in the project.

For example, in a current project I wanted to make sure that all custom events are overriding the clone function. If you drill down to the missing clone function rule, you can see a detailed description and example where it will be applied.



When you are done, you can easily export the ruleset if you have made any changes to it.

Once you're ready to run it, you have to download either the command line, ant or the maven version. I decided to use ant and there's a good example that you can build from easily.

An XML file is generated as output and you can either read it directly or use the online PMD Violations Viewer which shows you the result graphically.

If we want to see any custom events with a missing clone function, you can just drill down to the "EventMissingCloneFunction" and you'll see any events with a missing clone function.



Flex PMD really seems powerful but pretty simple to start using it.

  1. gravatar

    # by 123 123 - November 19, 2009 at 6:59 AM

    Great blog as for me. I'd like to read something more about this theme.
    By the way check the design I've made myself A level escort

  2. gravatar

    # by incion - February 7, 2012 at 2:43 AM

    Thanks for this useful post and website / blog links. I have already bookmark your blog
    cheap Web Design