File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -190,12 +190,20 @@ module.exports = function(grunt) {
190
190
grunt . registerTask ( 'validate' , 'Validate the quality of custom code.' , function ( mode ) {
191
191
phpcsConfig = grunt . config . get ( 'phpcs' ) ;
192
192
var files ;
193
+
193
194
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' , [ ] ) ;
197
198
validate . push ( 'phpcs:validate' ) ;
198
199
}
200
+ else {
201
+ files = filesToProcess ( phpcsConfig . validate . src ) ;
202
+ if ( files . length ) {
203
+ grunt . config . set ( 'phpcs.validate.src' , files ) ;
204
+ validate . push ( 'phpcs:validate' ) ;
205
+ }
206
+ }
199
207
}
200
208
eslintConfig = grunt . config . get ( 'eslint' ) ;
201
209
var eslintIgnoreError = grunt . config . get ( 'config.validate.ignoreError' ) === undefined ? false : grunt . config . get ( 'config.validate.ignoreError' ) ;
You can’t perform that action at this time.
0 commit comments