diff --git a/Gruntfile.js b/Gruntfile.js index 815999009f..4d4a88e6e7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1442,10 +1442,15 @@ module.exports = function(grunt) { var done = this.async(); var flags = this.flags; var args = changedFiles.php; - if ( flags.travis ) { - args = [ 'tests' ]; + if ( flags.travisErrors ) { + // We can check the entire codebase for coding standards errors. + args = [ 'lint:errors' ]; + } else if ( flags.travisWarnings ) { + // We can check the tests directory for errors and warnings. + args = [ 'lint', 'tests' ]; + } else { + args.unshift( 'lint' ); } - args.unshift( 'lint' ); grunt.util.spawn( { cmd: 'composer', args: args, @@ -1462,7 +1467,7 @@ module.exports = function(grunt) { // Travis CI tasks. grunt.registerTask('travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]); grunt.registerTask('travis:phpunit', 'Runs PHPUnit Travis CI tasks.', [ 'build', 'phpunit' ]); - grunt.registerTask('travis:phpcs', 'Runs PHP Coding Standards Travis CI tasks.', [ 'format:php:error', 'lint:php:travis:error' ]); + grunt.registerTask('travis:phpcs', 'Runs PHP Coding Standards Travis CI tasks.', [ 'format:php:error', 'lint:php:travisErrors:error', 'lint:php:travisWarnings:error' ]); // Patch task. grunt.renameTask('patch_wordpress', 'patch'); diff --git a/composer.json b/composer.json index 03f050fd4c..c795607093 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "wp-coding-standards/wpcs": "~2.1.0" }, "scripts": { - "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source", - "lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source" + "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source --cache -d memory_limit=256M", + "lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source --cache -d memory_limit=256M", + "lint:errors": "phpcs --standard=phpcs.xml.dist --report-summary --report-source --cache -d memory_limit=256M -n" } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c4cdc5d97b..82f21d12c2 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -5,6 +5,23 @@ + + + warning + + + warning + + + warning + + + warning + + + warning + +