grunt-php-cs-fixer-branch
Grunt plugin for running PHP Coding Standards Fixer just in
the modified files of the current git branch
Heavily inspired/copied from https://github.com/mgmcintyre/grunt-php-cs-fixer
Installation
- Install grunt-php-cs-fixer-branch
npm install grunt-php-cs-fixer-branch --save-dev
-
Install PHP Coding Standards Fixer
-
Include the task in your Gruntfile with a line like this
grunt.loadNpmTasks('grunt-php-cs-fixer-branch');
Usage Example
To be included in your Grunt initConfig
.
phpcsfixer: {
app: {},
options: {
bin: 'vendor/bin/php-cs-fixer',
ignoreExitCode: true,
level: 'all',
quiet: true
}
}
This task is a multi task so any targets, files and options should be specified accordingly.
Target Properties
###Options
bin
Type: String
Default: 'php-cs-fixer'
The path to php-cs-fixer
.
(For composer, use vendor/bin/php-cs-fixer
).
ignoreExitCode
Type: Boolean
Default: false
Don't fail even if we get a non-zero return.
verbose
Type: Boolean
Default: false
Output full info including warnings and a list of changes.
diff
Type: Boolean
Default: false
Show a diff for the proposed changes.
dryRun
Type: Boolean
Default: false
Don't effect the proposed changes (useful when combined with --verbose
and --diff
).
level
Type: String
Default: all
Chooses preset list of fixers, options are psr0
, psr1
, psr2
, all
.
fixers
Type: String|Array
Default: null
framework
Type: String
Default: default
Chooses option customizes the files to analyse, based on some well-known frameworks directory structures, options are magento
, sf20
, sf21
.
Comma-separated string, or array of fixers to use.
@see https://github.com/fabpot/PHP-CS-Fixer.
branch
Type: String
Default: master
The git branch to compare against
ignored
Type: String
Default: null
Pattern to ignore files