Skip to content

Commit

Permalink
Defer to phpcs.xml file if present.
Browse files Browse the repository at this point in the history
- Fixes #311
  • Loading branch information
jhedstrom committed Aug 31, 2017
1 parent daedab8 commit 78bb3b8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tasks/quality.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,18 @@ module.exports = function(grunt) {
grunt.registerTask('validate', 'Validate the quality of custom code.', function(mode) {
phpcsConfig = grunt.config.get('phpcs');
var files;

if (phpcsConfig && phpcsConfig.validate) {
files = filesToProcess(phpcsConfig.validate.src);
if (files.length) {
grunt.config.set('phpcs.validate.src', files);
// Defer to phpcs.xml/phpcs.xml.dist if present.
if (grunt.file.exists('./phpcs.xml') || grunt.file.exists('./phpcs.xml.dist')) {
grunt.config.set('phpcs.validate.src', []);
validate.push('phpcs:validate');
} else {
files = filesToProcess(phpcsConfig.validate.src);
if (files.length) {
grunt.config.set('phpcs.validate.src', files);
validate.push('phpcs:validate');
}
}
}
eslintConfig = grunt.config.get('eslint');
Expand Down

0 comments on commit 78bb3b8

Please sign in to comment.