A Grunt task plugin for running FlexPMD to lint/analyze apps built on Adobe Flex/ActionScript/MXML/Flash/AIR/etc. Think of it as "ASLint"/"FlexLint".
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-flexpmd --save-dev
While this Node/NPM module does not have any external dependencies itself, the underlying FlexPMD tool requires Java.
In your project's Gruntfile, add a section named
flexpmd to the data object passed into
A string value that is used as the single input directory.
If a [single] "src" directory is configured, it will override this
A string value that is used as the output directory in which to write the results file (named "pmd.xml" by default).
If a "dest" file is configured, it will override this
A string value that is used as the path to the FlexPMD ruleset. If no ruleset is specified, it will use the default FlexPMD ruleset.
An integer value 1-5 (where 1 is the highest priority and 5 is the least) that indicates the minimum
violation priority at which to fail the task. For example, if a single priority level
exists but you have configured
options.priority to be
3, the task will not fail.
Note that if you are also generating an XML report file, the report file will contain ALL violations rather than being filtered down based on this priority setting. (If you think this is a silly design choice, please open a new issue to discuss it.)
A Boolean value that indicates if the task should succeed even if there are analysis violations. This is probably most useful if you want to generate an XML analysis report for informational purposes but without impacting build status.
The following example configuration will run the default FlexPMD ruleset over all files in the "src/" directory.
The following example configuration will run the default FlexPMD ruleset over all files in the "src/" directory and
create a report file called "flexlint.xml" in the "reports/" directory. The task will pass even if there are violations
because of the
force: true option.
The following example configuration will run a custom FlexPMD ruleset over all files in the "src/" directory and create a report file called "pmd.xml" in the "reports/" directory. The task will fail if there are violations of priority level 3 or higher (1-3).
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.