Skip to content

Commit

Permalink
phpcbf and phpcs will now check against WP and WC standards
Browse files Browse the repository at this point in the history
  • Loading branch information
harriswong committed Jun 17, 2024
1 parent 9e93c9f commit 531ef92
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
17 changes: 0 additions & 17 deletions bin/wc-phpcbf

This file was deleted.

10 changes: 10 additions & 0 deletions bin/wc-phpcbf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# phpcbf returns exit-code as 1 even if all errors were fixed.
# https://github.com/squizlabs/PHP_CodeSniffer/issues/3057#issuecomment-919794895

composer run phpcbf $@

status=$?

[ $status -eq 1 ] && exit 0 || exit $status
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"phpunit"
],
"phpcs": [
"phpcs -s -p"
"./vendor/bin/phpcs -s -p --ignore=vendor,.git,assets,node_modules,dist,docker,release,bin --standard=WooCommerce-Core,WordPress-Core,WordPress-Extra"
],
"phpcbf": [
"phpcbf -p"
"./vendor/bin/phpcbf -p --ignore=vendor,.git,assets,node_modules,dist,docker,release,bin --standard=WooCommerce-Core,WordPress-Core,WordPress-Extra "
],
"check-security": [
"./vendor/bin/phpcs . --ignore=vendor,.git,assets,node_modules,dist,docker,release,bin --standard=./.phpcs.security.xml --report-full --report-summary"
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
'npm run eslint:fix',
],
'*.php': [
'bin/wc-phpcbf',
'sh bin/wc-phpcbf.sh',
],
};

0 comments on commit 531ef92

Please sign in to comment.