grunt-phpcs
Advanced tools
Comparing version
@@ -28,3 +28,3 @@ /* | ||
application: { | ||
dir: 'php/modules' | ||
dir: ['php/**'] | ||
}, | ||
@@ -31,0 +31,0 @@ options: { |
@@ -19,3 +19,3 @@ { | ||
}], | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "Gruntfile.js", | ||
@@ -22,0 +22,0 @@ "engines": { |
@@ -36,3 +36,3 @@ # grunt-phpcs | ||
application: { | ||
dir: 'application/classes' | ||
dir: ['application/classes/*.php', application/lib/**/*.php] | ||
}, | ||
@@ -48,5 +48,5 @@ options: { | ||
####dir | ||
Type: `String` | ||
Type: `Array` | ||
The file or directory where phpcs should search for files. | ||
Globbing pattern where phpcs should search for files. | ||
@@ -53,0 +53,0 @@ ###Options |
@@ -23,3 +23,2 @@ /* | ||
ignore: false, | ||
severity: false, | ||
standard: false, | ||
@@ -32,2 +31,13 @@ verbose: false, | ||
}, | ||
cliOptions = { | ||
errorSeverity: grunt.option('error-severity'), | ||
extensions: grunt.option('extensions'), | ||
ignore: grunt.option('ignore'), | ||
report: grunt.option('report'), | ||
reportFile: grunt.option('report-file'), | ||
severity: grunt.option('severity'), | ||
standard: grunt.option('standard'), | ||
warningSeverity: grunt.option('warning-severity'), | ||
verbose: grunt.option('verbose') | ||
}, | ||
cmd = null, | ||
@@ -46,3 +56,8 @@ done = null, | ||
if (grunt.option('extensions') || config.extensions) { | ||
if (config.errorSeverity !== undefined) { | ||
// The minimum severity required to display an error or warning | ||
cmd += ' --error-severity=' + config.errorSeverity; | ||
} | ||
if (config.extensions) { | ||
// A comma separated list of file extensions to check | ||
@@ -52,3 +67,3 @@ cmd += ' --extensions=' + config.extensions; | ||
if (grunt.option('ignore') || config.ignore) { | ||
if (config.ignore) { | ||
// A comma separated list of patterns to ignore files and directories. | ||
@@ -58,3 +73,3 @@ cmd += ' --ignore=' + config.ignore; | ||
if (grunt.option('severity') || config.severity) { | ||
if (config.severity !== undefined) { | ||
// The minimum severity required to display an error or warning | ||
@@ -64,3 +79,3 @@ cmd += ' --severity=' + config.severity; | ||
if (grunt.option('warning-severity') || config.warningSeverity) { | ||
if (config.warningSeverity !== undefined) { | ||
// The minimum severity required to display an error or warning | ||
@@ -70,3 +85,3 @@ cmd += ' --warning-severity=' + config.warningSeverity; | ||
if (grunt.option('standard') || config.standard) { | ||
if (config.standard) { | ||
// Define the code sniffer standard. | ||
@@ -76,3 +91,3 @@ cmd += ' --standard=' + config.standard; | ||
if (grunt.option('report-file') || config.reportFile) { | ||
if (config.reportFile) { | ||
// Define the file to write the report to. | ||
@@ -82,3 +97,3 @@ cmd += ' --report-file=' + config.reportFile; | ||
if (grunt.option('report') || config.report) { | ||
if (config.report) { | ||
// Define the style of the report. | ||
@@ -88,3 +103,3 @@ cmd += ' --report=' + config.report; | ||
if (grunt.option('verbose') || config.verbose === true) { | ||
if (config.verbose === true) { | ||
// Output more verbose information. | ||
@@ -103,7 +118,15 @@ cmd += ' -v'; | ||
var dir = path.normalize(runner.data.dir); | ||
var dir = runner.data.dir, | ||
attr; | ||
config = runner.options(defaults); | ||
cmd = buildCommand(dir) + ' ' + dir; | ||
grunt.log.writeln('Starting phpcs (target: ' + runner.target.cyan + ') in ' + dir.cyan); | ||
for (attr in cliOptions) { | ||
if (cliOptions[attr] !== undefined) { | ||
config[attr] = cliOptions[attr]; | ||
} | ||
} | ||
cmd = buildCommand(dir) + ' ' + grunt.file.expand(dir).join(' '); | ||
grunt.log.writeln('Starting phpcs (target: ' + runner.target.cyan + ') in ' + dir.join(' ').cyan); | ||
grunt.verbose.writeln('Exec: ' + cmd); | ||
@@ -110,0 +133,0 @@ |
11307
6.44%190
11.76%