grunt-phpcs
Advanced tools
Comparing version
@@ -28,6 +28,7 @@ /* | ||
application: { | ||
dir: '../grunt_test/source/application' | ||
dir: 'application/classes' | ||
}, | ||
options: { | ||
bin: 'vendor/bin/phpcs' | ||
bin: 'vendor/bin/phpcs', | ||
standard: 'Zend' | ||
} | ||
@@ -34,0 +35,0 @@ } |
@@ -15,3 +15,3 @@ { | ||
"contributors": [], | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "Gruntfile.js", | ||
@@ -18,0 +18,0 @@ "engines": { |
@@ -7,3 +7,2 @@ # grunt-phpcs | ||
##Getting Started | ||
@@ -13,3 +12,3 @@ 1. Install this grunt plugin with the following command: | ||
```shell | ||
npm install grunt-phpcst --save-dev | ||
npm install grunt-phpcs --save-dev | ||
``` | ||
@@ -33,2 +32,17 @@ | ||
###Usage Example | ||
```js | ||
phpcs: { | ||
application: { | ||
dir: 'application/classes' | ||
}, | ||
options: { | ||
bin: 'vendor/bin/phpcs', | ||
standard: 'Zend' | ||
} | ||
} | ||
``` | ||
###Target Properties | ||
@@ -38,3 +52,3 @@ ####dir | ||
The directory where phpcs should search for files. | ||
The file or directory where phpcs should search for files. | ||
@@ -50,18 +64,24 @@ ###Options | ||
####extensions | ||
Type: `String` Default: `false` | ||
A comma separated list of file extensions to check. This option can also be set by running the task with `--extensions=<extensions>`. | ||
####ignore | ||
Type: `String` Default: `false` | ||
A comma separated list of patterns to ignore files and directories. This option can also be set by running the task with `--ignore=<ignore>`. | ||
####severity | ||
Type: `Integer` Default: `false` | ||
The minimum severity required to display an error or warning. This option can also be set by running the task with `--severity=<severity>`. | ||
####standard | ||
Type: `String` Default: `false` | ||
Define the standard to use. This option can also be set by running the task with `--standard=<standard>`. | ||
####verbose | ||
Type: `Boolean` Default: `false` | ||
Output more verbose information. This option can also be set by running the task with `--verbose`. | ||
###Usage Example | ||
```js | ||
phpucs: { | ||
application: { | ||
dir: 'app/php/' | ||
}, | ||
options: { | ||
bin: 'vendor/bin/phpcs' | ||
} | ||
} | ||
``` | ||
Output more verbose information. This option can also be set by running the task with `--verbose`. |
@@ -26,2 +26,6 @@ /* | ||
debug: false, | ||
extensions: false, | ||
ignore: false, | ||
severity: false, | ||
standard: false, | ||
verbose: false | ||
@@ -39,2 +43,22 @@ }); | ||
if (grunt.option('extensions') || options.extensions) { | ||
// A comma separated list of file extensions to check | ||
cmd += ' --extensions=' + options.extensions; | ||
} | ||
if (grunt.option('ignore') || options.ignore) { | ||
// A comma separated list of patterns to ignore files and directories. | ||
cmd += ' --ignore=' + options.ignore; | ||
} | ||
if (grunt.option('severity') || options.severity) { | ||
// The minimum severity required to display an error or warning | ||
cmd += ' --severity=' + options.severity; | ||
} | ||
if (grunt.option('verbose') || options.standard) { | ||
// Define the code sniffer standard. | ||
cmd += ' --standard=' + options.standard; | ||
} | ||
if (grunt.option('verbose') || options.verbose === true) { | ||
@@ -48,3 +72,3 @@ // Output more verbose information. | ||
grunt.log.writeln('Starting phpunit (target: ' + this.target.cyan + ') in ' + dir.cyan); | ||
grunt.log.writeln('Starting phpcs (target: ' + this.target.cyan + ') in ' + dir.cyan); | ||
grunt.verbose.writeln('Exec: ' + cmd); | ||
@@ -51,0 +75,0 @@ |
7219
26.14%115
22.34%82
32.26%