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 Jan 5, 2017
1 parent 35d4da7 commit 603bed5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tasks/quality.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,20 @@ 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');
var eslintIgnoreError = grunt.config.get('config.validate.ignoreError') === undefined ? false : grunt.config.get('config.validate.ignoreError');
Expand Down

0 comments on commit 603bed5

Please sign in to comment.