Skip to content

Commit

Permalink
PHPCS 3.0 will throw exit code 3 for fixable errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arnested committed May 15, 2017
1 parent ef7f9bb commit 6db3973
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ var phpcsPlugin = function(options) {
return;
}

if (exitCode > 1) {
// On codding style problems Code Sniffer should exists with "1" code.
if (exitCode > 2) {
// On codding style problems Code Sniffer should exists with "1" or "2" code.
// All other non-zero exit codes should be treated as Code Sniffer errors.
var phpcsError = new gutil.PluginError('gulp-phpcs', 'Execution of Code Sniffer Failed');
phpcsError.stdout = output;
Expand All @@ -218,7 +218,7 @@ var phpcsPlugin = function(options) {
output: ''
};

if (exitCode === 1) {
if ((exitCode === 1) || (exitCode === 2)) {
// A codding style problem is found. Attache report to the file to allow
// reporters do their job.
report.error = true;
Expand Down
4 changes: 2 additions & 2 deletions test/fixture/error
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
cat > /dev/null
# It's just an arbitrary text.
echo "This is a test error."
# PHPCS uses exit-codes greater than 1 to report about real errors.
exit 2
# PHPCS uses exit-codes greater than 2 to report about real errors.
exit 3

0 comments on commit 6db3973

Please # to comment.