Skip to content

Commit d326f22

Browse files
committed
PHPCS 3.0 will throw exit code 2 for fixable errors
See squizlabs/PHP_CodeSniffer#930
1 parent ef7f9bb commit d326f22

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ var phpcsPlugin = function(options) {
202202
return;
203203
}
204204

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

221-
if (exitCode === 1) {
221+
if ((exitCode === 1) || (exitCode === 2)) {
222222
// A codding style problem is found. Attache report to the file to allow
223223
// reporters do their job.
224224
report.error = true;

test/fixture/error

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
cat > /dev/null
55
# It's just an arbitrary text.
66
echo "This is a test error."
7-
# PHPCS uses exit-codes greater than 1 to report about real errors.
8-
exit 2
7+
# PHPCS uses exit-codes greater than 2 to report about real errors.
8+
exit 3

0 commit comments

Comments
 (0)