Skip to content

Commit

Permalink
Chore: phpcbf and phpcs will now check against WP and WC standards (#…
Browse files Browse the repository at this point in the history
…2749)

* phpcbf and phpcs will now check against WP and WC standards

* Update wp-coding-standards to 3.0+

* Update coding-standards/wpcs woocommerce/woocommerce-sniffs squizlabs/php_codesniffer wp-coding-standards/wpcs woocommerce/qit-cli dependencies

* Update phpcodesniffer-composer-installer

composer require -W --dev dealerdirect/phpcodesniffer-composer-installer
  • Loading branch information
harriswong authored Jun 20, 2024
1 parent 9e93c9f commit c776ec5
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 174 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
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"require-dev": {
"woocommerce/woocommerce-sniffs": "^0.1.3",
"phpunit/phpunit": "^9.6.8",
"squizlabs/php_codesniffer": "^3.7.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"wp-coding-standards/wpcs": "^2.3",
"woocommerce/qit-cli": "^0.4.0"
"squizlabs/php_codesniffer": "^3.10",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-coding-standards/wpcs": "^3.1",
"woocommerce/qit-cli": "^0.5.3",
"woocommerce/woocommerce-sniffs": "^0.0.2"
},
"require": {
"automattic/jetpack-connection": "^2.1.0",
Expand All @@ -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
Loading

0 comments on commit c776ec5

Please sign in to comment.