// you’re reading...

news

FlexPMD test with Ant

Yesterday, Adobe released FlexPMD, a great tool to automatically detect code anti-patterns, code smells, common bad practices in a Flash/Flex based source code.

I tried it this morning and it’s working great. Thanks to Xavier Agnetti for this good piece of software ! I didn’t test at this time how to set custom rules. That’s on my todo list because I think that’s the most interesting part of this project.

I encountered some minor problems to run Ant task as described on the official site. Few imports was missing (commons-lang-2.4, flex-pmd-files, as3-parser-api), some mismatched with the current versions included in the zip (as3-parser and as3-plugin-utils). – Edit: Xavier just fixed the documentation.
Another thing, default rule file was unreachable. I didn’t check the jars to check if the rule file was included. – Edit: See Xavier’s comment below.
I choosed to export it directly from ruleset creator application and target the new file from my Ant task. If you need it, I uploaded it here.

Here’s a snapshot of my Ant task modified to make it working with my project.. Check from line 237 to 258.

Discussion

7 Responses to “FlexPMD test with Ant”

  1. Thanks a lot Francis, as explained on Twitter with your pdm.xml file and your build file it works as expected.

    Now we need a Flex integration to get a report in the Problems Report window to have « go to line » support etc… :) Hope that Adobe planned to work on this.

    Posted by Tek | 2 septembre 2009, 14 h 50 min
  2. Content que tu apprecies le projet :)

    About the ruleset, if you don’t specify any ruleset, the default will be loaded.

    Xavier

    Posted by Xavier Agnetti | 2 septembre 2009, 14 h 50 min
  3. @Tek: About the Eclipse plugin, any help is more than welcomed on that part :)

    Posted by Xavier Agnetti | 2 septembre 2009, 14 h 52 min
  4. Hi Francis,

    I just tested FlexPMD as well, it’s really promising thanks to the ruleset creator.

    However I really doubt some of the « good practices » they try to taught us. Such as the clone method on events : Why locking dispatched events in the first place ?
    Or concerning the use of the * type : Why not providing generics or covariant typing to ensure strong typing and flexibility ?

    Now, with a more pertinent ruleset I think it could be really useful :)

    Posted by Cédric | 2 septembre 2009, 14 h 54 min
  5. @Xavier

    Sur la doc il y a une petite erreur :

    c’est 1.0.RC3 sinon il trouve pas les fichiers

    Sinon le projet est bien sympa !

    Posted by Olivier | 2 septembre 2009, 15 h 24 min
  6. @Tek You’re definitely right, because reading the report to indentify the problems in source files is a big waste of time.

    @Xavier Thanks for the tip! Maybe you could add it to the documentation.

    @Cédric Same here! I’m not convinced by the default ruleset but as I say, the possibility of defining custom rules is one of the greatest key of this project.
    I can see with FlexPMD some great opportunities. Ex: Define a ruleset to encourage good practises with a framework. At this time, AS3 language features can’t totally secure developers from using bad practises to work with an architecture. FlexPMD with an intelligent ruleset and some comprehensive warnings could be one key to lead them along their learning curve. Last but not least, warnings and inconsitencies detections inside the framework could be less verbose and resulted binaries should be more optimized (with less statements to detect developers pitfalls).

    Posted by Francis Bourre | 2 septembre 2009, 15 h 36 min
  7. hi there.
    still couldn’t get the ANT script to work properly … are there still error in the example on http://opensource.adobe.com/wiki/display/flexpmd/How+to+invoke+FlexPMD ?

    phil

    Posted by Philipp | 4 septembre 2009, 17 h 29 min

Post a comment