itBooze Code Quality Tools for ActionScript by  Lena Petsenchuk
Upcoming SlideShare
Loading in...5

itBooze Code Quality Tools for ActionScript by Lena Petsenchuk






Total Views
Views on SlideShare
Embed Views



5 Embeds 464 143 119 109 84 9



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

itBooze Code Quality Tools for ActionScript by  Lena Petsenchuk itBooze Code Quality Tools for ActionScript by Lena Petsenchuk Presentation Transcript

  • CODE QUALITY FlexPMD Overview by Lena Petsenchuk
  • Agenda
    • FlexPMD
      • What is FlexPMD
      • Why FlexPMD
      • How to invoke
      • How does it work
      • Types of rules
    • FlexPMD plugin
      • Installation/Uninstallation
      • Configure FlexPMD plugin
      • Supported workflows
      • FlexPMD Outline
      • FlexCPD integration
      • Usage strategies
      • FlexPMD Ruleset Creator
      • Known issues
  • What is FlexPMD
    • FlexPMD is a tool that helps to improve code quality by auditing any AS3/Flex source directory and detecting common bad practices.
    • “ Any fool can write code that a computer can understand.
    • Good programmers write code that humans can understand.”
    • ~Martin Fowler
    Why FlexPMD
  • Why FlexPMD
    • “ You can’t control what you can’t measure.”
    • ~Tom DeMarco
  • Why FlexPMD
  • Why FlexPMD
    • FlexPMD can detect:
    • Coding standards violations
    • Code duplication
    • Unused code (functions, variables, constants, 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.)
  • How to invoke
    • FlexPMD can currently be invoked from:
    • The command line
    • Maven
    • Ant
    • Automator on Mac OS X
    • Eclipse
    • FlexBuilder
    • TextMate on Mac OS X
    • FlashDevelop
  • How does it work
    • FlexPMD is delivered with a set of standard rules for Flex/AS development. Each source file that is processed is checked against every rule.
    • Currently, FlexPMD produces a XML report by default, plus an HTML report when invoked by the Maven site plugin. The XML report can then be consumed by any PMD reports pretty printers (like the PMD hudson plugin).
  • Types of rules
    • There are various kinds of rules:
    • Regular expression based : the rule will process each file line-by-line searching for the specified pattern, and detecting possible violations.
    • Abstract Synthax Tree (AST) based : the rule will analyze the abstract syntax tree for an ActionScript class to detect possible violations. For example, detecting a deeply nested if-statement.
    • XPath based : the rule will serialize the AST into an XML stream and then use an XPath expression to to detect possible violations.
  • FlexPMD Plugin
    • The FlexPMD Plugin is a plugin to streamline the development process in regards to FlexPMD violations
    • It analyses the code and marks the violations inline in the code so that developers can see them as they develop
    • It allows easy navigation between the list of violations and the associated code
  • Installation/Unistallation
    • The installation and uninstallation process follow Eclipse standard mechanisms
    • Installation
      • Help > Install new software
      • Use the following update site:
      • Select FlexPMD feature and proceed with the installation
    • Uninstallation
      • Help > Product Details > Installation Details
  • Configure FlexPMD plugin
    • Download FlexPMD command line tools ( )
    • FlexPMD command line . This is a mandatory field. You have to select the flex-pmd-command-line.jar you want from your hard drive.
    • FlexPMD custom ruleset . You can leave this field empty, if so a default ruleset will be used.
    • FlexCPD command line . You have to select the flex-pmd-cpd-command-line.jar you wish from your hard drive.
  • Supported workflows
    • FlexPMD plugin targets two different type of users with two different goals:
    • Code review workflow : As a code reviewer I want to be able to audit and review the quality of an entire project or any given functional area in terms of PMD violations.
    • Development workflow : As a developer I want to see PMD violations in the files I'm working in. If a file changes the violations should be updated immediately.
  • Code review workflow
    • Ideal for
    • Projects that didn’t use FlexPMD from the very beginning
    • Projects where not all developers use FlexPMD
    • Code or Application reviews to check the health of the code
    • Audit specific functional areas
    • Benefits
    • FlexPMD recommendations are displayed in a specific panel and can be sorted attending its relevance or violation type
  • Code Review workflow
    • Select any source folder in a project
    • Right click on it
    • Select FlexPMD > Run FlexPMD
  • Development workflow
    • Ideal for
    • Projects that start using FlexPMD from the very beginning
    • Teams that proactively want to promote Collective code and team best practices
    • Benefits
    • FlexPMD recommendations become a first class citizen during development.
    • During compilation FlexPMD errors can prevent the entire build to succeed and will be displayed in the standard Errors view
    • FlexPMD execute automatically on every compilation
  • Development workflow
    • Right click in a project
    • Select FlexPMD > Add FlexPMD Nature
    • Note: If at any point you want to remove the nature you can select FlexPMD > Remove FlexPMD Nature
  • FlexPMD Outline
    • In the FlexPMD Outline View you'll see the violations in the currently opened editor.
    • If the arrows button is toggled, whenever the file is saved FlexPMD will be re-executed on it and the Outline will be updated providing always up-to-date information to the developer with very little delay and without having to compile the entire project.
  • FlexCPD integration
    • FlexCPD can detect suspect copy/paste sections of code in your project.
    • Executes on demand
    • You can execute FlexCPD by right-click in a source folder and select FlexPMD > Find suspect cut & paste.
    • Creates a list of snippets of duplicated code
    • You can navigate to the source code file by double clicking on the item
  • Usage strategies
    • Fine tune your ruleset
    • Filtering problems
    • Projects with lots of violations
  • FlexPMD Ruleset Creator
  • Build your ruleset – Prioritize the rules
  • Known issues
    • If when you run FlexPMD you get empty results or apparently it doesn't even execute these might be the causes:
    • You're not using the latest version of FlexPMD. You should be using 1.0.1 or above
    • The path to the command line jars contains spaces. See
    • The path of your workspace or project contain spaces. See
  • Summary