Using Flex PMD in FlashDevelop 3

Filed in EXAMPLES , FEATURED , TUTORIALS 10 comments

FlashDevelop 3

Adobe recently made available Flex PMD a tool that lets you keep track of your code bad practices and helps you  by auditing your source directory and displaying  common errors such as:

  • Unused code (functions, variables, constants, etc.)
  • Inefficient code (misuse of dynamic filters, heavy constructors, etc.)
  • Over-complex code (nested loops, too many conditionals, etc.)
  • Over-long code (classes, methods, etc.)
  • Incorrect use of the Flex component lifecycle (commitProperties, etc).

A report is produced describing the violations of a given rule set. FlexPMD includes a rule set that is broad ranging and continually growing. It is also straightforward to create your own new rules.

Originally Flex PMD can be called from: Ant, The Command Line and Maven, but thanks to the FlashDevelop (FD3 from now on ) community a plugin has been made available that lets you use FlexPMD in the FD3 IDE and throws the result right in the Output and Results window of FD3.

flexpmdinfd3

Installation

1. Download flashdevelopPMD from http://www.kemelyon.com/flashdevelop/flashdevelopPMD.zip

2. Copy PMD.dll into the plugins folder of your FD Application Files.

fdsettings

fdplugins

3. Download flexPMD from Adobe Labs (http://opensource.adobe.com/wiki/displa … /Downloads) and extract to your disk.

adobeos

Set “PMD jar Location” in Tools -> Settings -> FlexPMD to your “flex-pmd-command-line-1.0.RC3.jar”

flexpmdlocation

Usage

Press Ctrl-Shift-A to run FlexPMD in current Project. This version only checks code inside the “src” folder, so you don’t see warnings in your libraries.

To use your own ruleset, set “PMD Ruleset” in Tools -> Settings -> FlexPMD

Thanks again to the FlashDevelop community for spending time in making this useful plugins.

Creative Commons License
Using Flex PMD in FlashDevelop 3 by David Gamez, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.5 Mexico License.

Posted by Dave Gamez   @   18 September 2009 10 comments
Tags : , , , ,

Share This Post

RSS Digg Twitter StumbleUpon Delicious Technorati

10 Comments

Comments
Sep 18, 2009
12:27 pm
#1 Ragona :

This is sweet. Just installed it, and I’m going to recommend it to the rest of my team. Thanks for the post!

Sep 18, 2009
2:28 pm
#2 swfgeek :

Yeah Ryan it’s pretty useful and helps you to improve your code, and the fact that you can write your own rules makes it even better.

Sep 18, 2009
3:12 pm
#3 Ragona :

I’m getting some weird errors out of it – like it insists on throwing errors for my package names on the basis that they have capitol letters, but they certainly do not. It also only wants you to use addChild in an “addChildren()” method – which seems a little excessive.

Sep 18, 2009
3:37 pm
#4 swfgeek :

Yes it appears to have some bugs but some of them are already reported like “The copyright header is missing in this file” and ” A package name should be lower case. Detects when a package definition contains upper case characters” guess we have to wait until Adobe fixes those bugs or write our own sets of rules. We can fill a bug at https://bugs.adobe.com/jira/browse/FLEXPMD or ask some specific question at http://forums.adobe.com/community/opensource/flexpmd?view=discussions&start=0

Sep 24, 2009
9:51 am
#5 Iain :

That’s great news. Will install, test and blog my results – doubtless FD3 will come out looking better than my code…

Feb 25, 2010
6:59 am
#6 GameDEveloper :

Dude, how can I make PMD use code not in src folder, or where does PMD search for src folder

Mar 3, 2010
5:18 pm
#7 swfgeek :

The current version of Flex PMD will only check your src folder but You can write your own rulesets to add more folders or rules here’s how to doit if you’re using Flash Develop:
Usage: Press Ctrl-Shift-A to run FlexPMD in current Project. This version only checks code inside the “src” folder, so you don’t see warnings in your libraries. To use your own ruleset, set “PMD Ruleset” in Tools -> Settings -> FlexPMD

Mar 3, 2010
11:38 pm
#8 GameDEveloper :

Thank you , but u still didnt do me any favour bro. that much i knew. can u atleast tell me where PMD search for this “src” folder.

Mar 4, 2010
1:43 am
#9 swfgeek :

Sure, The Plugin for Flash Develop wil search in Your project’s folder, I haven’t tested on Eclipse yet, only Flash Develop and command prompt. On command prompt You can select the folder that you want FlexPMD to “scan” like this: java -Xmx256m -jar “C:/FlexPMD/flex-pmd-command-line-1.0.jar” -s “C:/THE/DIRECTORY/YOU/WANT/TO/SCAN/” -o . -r “C:/FlexPMD/pmd.xml”
Hope this helps.

Trackbacks to this post.
Leave a Comment

Previous Post
«
Next Post
»
Sailor!Moon is for Moooonday!Sunny Sunday!Great version of one of my characters by my friend @chopernawersEye Spy!0.05 #doodlesNightly #DoodlesWorking on some prints for #Halloween here's #Dracula #ClassicMonstersIn it for the Money $$$!
Delighted Black designed by Zenverse