Skip to content

Commit

Permalink
Add wrapper script for phpcbf to convert 1 exit code to 0 exit code
Browse files Browse the repository at this point in the history
Fixes #2111
  • Loading branch information
westonruter committed May 21, 2019
1 parent a5a6f05 commit ce85484
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions bin/phpcbf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Wrap phpcbf to turn 1 success exit code into 0 code.
# See https://github.com/squizlabs/PHP_CodeSniffer/issues/1818#issuecomment-354420927

root=$( dirname "$0" )/..

"$root/vendor/bin/phpcbf" $@
exit=$?

# Exit code 1 is used to indicate that all fixable errors were fixed correctly.
if [[ $exit == 1 ]]; then
exit=0
fi

exit $exit
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"lint:js": "wp-scripts lint-js .",
"lint:js:fix": "npm run lint:js -- --fix",
"lint:php": "vendor/bin/phpcs",
"lint:php:fix": "vendor/bin/phpcbf",
"lint:php:fix": "./bin/phpcbf.sh",
"lint:pkg-json": "wp-scripts lint-pkg-json . --ignorePath .gitignore",
"start": "wp-scripts start",
"test": "npm-run-all --parallel test:*",
Expand Down

0 comments on commit ce85484

Please sign in to comment.