Skip to content

Commit

Permalink
modify commit hook to not fail on phpcs warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
itismadness committed Nov 4, 2020
1 parent 4717875 commit b297527
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 244 deletions.
18 changes: 18 additions & 0 deletions .bin/phpcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# This is a wrapper script around calling vendor/bin/phpcs as it will return
# 0 when no errors or warnings are found, 1 for only warnings, and 2 if any errors
# are found. We do not want to fail our CI pipeline on warnings, but still want to
# show them.
# See https://github.com/squizlabs/PHP_CodeSniffer/issues/1818#issuecomment-354420927

root=$( dirname $0 )/..

$root/vendor/bin/phpcs $@
exit=$?

if [[ $exit == 1 ]]; then
exit=0
fi

exit $exit
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"browser-sync": "^2.26.13",
"browser-sync-webpack-plugin": "^2.2.2",
"husky": "^4.2.5",
"lint-staged": "^9.5.0",
"lint-staged": "^10.5.0",
"stylelint": "^13.3.2",
"stylelint-checkstyle-formatter": "^0.1.2",
"stylelint-config-recommended": "^3.0.0",
Expand All @@ -40,15 +40,15 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged --verbose"
}
},
"lint-staged": {
"*.php": [
"php -l",
".bin/phpcbf",
"vendor/bin/phpstan analyse",
"vendor/bin/phpcs"
".bin/phpcs"
]
},
"browserslist": [
Expand Down
Loading

0 comments on commit b297527

Please sign in to comment.