Skip to content

Commit 78bb3b8

Browse files
committed
Defer to phpcs.xml file if present.
- Fixes #311
1 parent daedab8 commit 78bb3b8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tasks/quality.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,18 @@ module.exports = function(grunt) {
190190
grunt.registerTask('validate', 'Validate the quality of custom code.', function(mode) {
191191
phpcsConfig = grunt.config.get('phpcs');
192192
var files;
193+
193194
if (phpcsConfig && phpcsConfig.validate) {
194-
files = filesToProcess(phpcsConfig.validate.src);
195-
if (files.length) {
196-
grunt.config.set('phpcs.validate.src', files);
195+
// Defer to phpcs.xml/phpcs.xml.dist if present.
196+
if (grunt.file.exists('./phpcs.xml') || grunt.file.exists('./phpcs.xml.dist')) {
197+
grunt.config.set('phpcs.validate.src', []);
197198
validate.push('phpcs:validate');
199+
} else {
200+
files = filesToProcess(phpcsConfig.validate.src);
201+
if (files.length) {
202+
grunt.config.set('phpcs.validate.src', files);
203+
validate.push('phpcs:validate');
204+
}
198205
}
199206
}
200207
eslintConfig = grunt.config.get('eslint');

0 commit comments

Comments
 (0)