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".
npm install grunt-flexpmd> 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".
~0.4.2If 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:
``shell`
npm install grunt-flexpmd --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-flexpmd');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
flexpmd: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
`$3
#### options.input
Type:
String
Default value: nullA string value that is used as the single input directory.
If a [single] "src" directory is configured, it will override this
input option.
#### options.output
Type:
String
Default value: nullA 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
output option.
#### options.ruleset
Type:
String
Default value: nullA string value that is used as the path to the FlexPMD ruleset.
If no ruleset is specified, it will use the default FlexPMD ruleset.
#### options.priority
Type:
Number
Default value: 5An 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
5 violation
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.)_
#### options.force
Type:
Boolean
Default value: falseA 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.
$3
#### Basic Example
The following example configuration will run the default FlexPMD ruleset over all files in the "src/" directory.
`js
grunt.initConfig({
flexpmd: {
example1: {
src: 'src/'
}
}
});
`
#### XML Report Example
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.`js
grunt.initConfig({
flexpmd: {
example2: {
options: {
force: true
},
'reports/flexlint.xml': ['src/']
}
}
});
`#### Custom Ruleset Example
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).
`js
grunt.initConfig({
flexpmd: {
options: {
input: 'src/',
output: 'reports/',
priority: 3
},
example3: {
options: {
ruleset: 'config/myCustomRuleset.xml'
}
}
}
});
``