Jai’s Weblog – Tech, Security & Fun…

Tech, Security & Fun…

  • Jaibeer Malik

    Jaibeer Malik
  • View Jaibeer Malik's profile on LinkedIn
  • Subscribe

  • Feedburner

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 29 other followers

  • Archives

  • Categories

  • Stats

    • 379,210
  • Live Traffic

ActionScript/Flex/AIR Code Quality Measurement Tools

Posted by Jai on December 7, 2009

From a java developer perspective, you would love to have the similar code quality measurement tools for ActionScript/Flex/Air also but there is hardly any single comparable tool available for this. After a long search and analysis, this is what I have found and here we will have a look at what all these tools and different utilities offer.

In this post we will analyze what different code quality metrics on a general basis we would require for ActionScript/Flex/AIR and what are the different available tools to get such metrics.

Code Quality Metrics

We would like to have the metrics to display different information like:

  • Coding Styles: The metrics which tell us the different coding style violations inside the code.
  • Coding Standards: The metrics which tell us the different coding standards violations inside the code.
  • Project level: Total number of packages, interface, classes etc. , the dependencies between different packages and classes and their linking.
  • Class level: Total number of lines of code, number of functions, cyclomatic complexity, dependencies on other classes etc.
  • Function level: Total number of lines of code, cyclomatic complexity etc. and coverage tools stating if all the lines of code are fully tested on not.

(This is just on broader level, not covering all the metrics and information which similarly we have for java).

List of Available Tools

The available tools for AcrionScript/Flex/Air code quality measurement are:

  • flexcover
  • FlexPMD
  • FlexCPD
  • it-depends
  • asdox
  • Enterprise IDE Plugin
  • Apollo
  • Compiler options
  • Link-Visualizer

(The list may not be complete, but it is as per my best knowledge which I could find around, Feel free to comment and add to it :)).

flexcover

It is,

“Code Coverage Tool for Flex and AIR applications.”

The tool description,

“This project provides code coverage instrumentation, data collection and reporting tools for Adobe Flex and AIR applications.

Flexcover is a code coverage tool for Flex, AIR and AS3. It incorporates a modified version of the AS3 compiler which inserts extra function calls in the code within the SWF or SWC output file. At runtime, these function calls send information on the application’s code coverage to a separate tool; The modified compiler also emits a separate “coverage metadata” file that describes all the possible packages, classes, functions, code blocks and lines in the code, as well as the names of the associated source code files. “

Screenshot:

Download: From home page downloads section.

To get started: See wiki page for details, Flexcover Usage Hints

Build-Process: To integrate it with your build process

For more details, also have a look at Alex’s blog

FlexPMD

It uses part of PMD for java,

FlexPMD is a tool that helps to improve code quality by auditing any AS3/Flex source directory and detecting common bad practices, 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.)”

What’s FlexPMD:

Screenshot:

Downloads: From home page, downloads section

To get started: See How to invoke FlexPMD section to use it from command-line, ant, maven etc.

PMD ruleset creator: Create your own PMD ruleset using FlexPMD Ruleset Creator, and you can also create your own PMD Rules.

Violations Viewer: View the generated results using PMD Violations Viewer, and you can also use PMD Hudson plugin to view the results.

FlexCPD

It is Copy & Paste Detector,

“FlexCPD is reusing the JavaCPD engine. This project consists in giving a stream of tokens to the CPD engine using the FlexPMD lexer and let the CPD engine detects duplications in those streams.”

Screenshot:

Download: From the downloads section.

To get started: You can use either command-line, ant or maven to generate the report, see How to invoke section.

Viewer: You can use Hudson DRY plugin to see the results.

it-depends

It is, “Visual browser for class and package dependencies in Flex applications”

“ItDepends is a tool for visually exploring the dependencies between classes and packages in an Adobe Flex application, with the aim of making it easy for developers to understand how their application can be made smaller and/or broken up into dynamically loadable modules.”

Screenshot:

Download: From downloads section.

Introduction: Why should you use it and what information does it display, see the introduction section.

To get started: To get started, have a look at User’s Guide.

asdox

It is, “asDox is a actionscript 3 parser for extracting class/interface/method definitions from source files complete with JavaDoc @tags.”

“asDox is an Actionscript 3 parser written in Python. It is based on qDox for Java. The parser skims the source files only looking for things of interest such as class/interface definitions, import statements, JavaDoc tags and member declarations. The parser ignores things such as actual method implementations to avoid overhead. The end result of the parser is a very simple document model containing enough information to be useful.”

Downloads: See downloads section.

To get started: Have a look at UsingasDox for details.

Enterprise IDE Plugin

It is,

“The Enterprise IDE Plugin is an architect and developer productivity suite for Adobe(R) Flex (R) Builder 3 designed to simplify and aid the development of Enterprise Applications using Flex Builder 3.”

Screenshot:

Features: Have a look at different features list.

Metrics: See what all metrics it provides.

Apollo

It is,

“It analyzes actionscript code and produces some basic stats: number of files, breakdown of lines of code (comments versus whitespace versus real code), and it counts functions and variables. Not really useful for anything in real life, I was just curious how large the Flex SDK was, so I wanted a way to figure that out.”

Screenshot:

Not sure how useful it is, but see if it gives you some idea to design or develop your own utility.

Compiler options

“You can generate a report of linker dependencies by setting the link-report compiler option to true. The output of this compiler option is a report that shows linker dependencies in an XML format.”

Examining linker dependencies: Use compiler option to examine the dependencies to reduce the swf file size.

Link-Visualizer

It is,

“AIR Link Report visualizer to visualize report generated by above compiler link-report option.”

Screenshot:

For more details, see the post AIR Link Report visualizer.

Conclusion

Most of the above tools are still in the very early stages of development and does not much cater the usefulness in the practical scenarios. There is still a long way to go for these tools to be able to the reach the maturity level which we have for java tools. But still something is better than nothing and of-course we are in the right direction at least to have something going on.

I am planning to cover few of these in details covering different pros and cons and how these fit in actual scenarios. In the mean time feel free to share your related experiences.

7 Responses to “ActionScript/Flex/AIR Code Quality Measurement Tools”

  1. Mayur said

    Thanks for sharing a nice post.

    ~ Mayur

  2. Social comments and analytics for this post…

    This post was mentioned on Twitter by jaibeermalik: #Flex Code Quality Measurement Tools, https://jaibeermalik.wordpress.com/2009/12/07/actionscript-flex-air-code-quality-measurement-tools/

  3. Brian said

    Thanks for the write-up. Didn’t realize they released a CPD version with FlexPMD, great to hear.

  4. […] find some of the tools used for maintaining the code quality for AS ,Flex,AIR in the post “ActionScript/Flex/AIR Code Quality Measurement Tools” by Jaibeer […]

  5. Sri said

    I really appreciate your efforts to share this information with the world.

    Thanks
    Sri

  6. Sharedtut said

    Thank you for pointing out all of these information, great work.

  7. bhargav swargam said

    hi jai,

    wonderful job…this information is greatly helpful to me.

    thanks and keep do posting such interesting stuff.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: