-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: phpcbf and phpcs will now check against WP and WC standards #2749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried running composer phpcbf woocommerce-services.php
but I got "no fixable errors were found":
I shouldn't make a difference, but I tried calling the shell script directly as well and got the same results (./bin/wc-phpcbf.sh woocommerce-services.php
).
AFAIK then nothing has been merged into trunk that should have fixed any errors.
If you're still seeing them @harriswong, can you share a few examples of what it complains about? I'm curious if I can force something on my end 😄
I am also getting the same results as @kallehauge, I also noticed my version of wpcs was throwing a parser error in the
After this I did not get any more parser errors and PHPCS was reporting errors as it should, this did not however produce the results as per testing instructions. Do you think we should consider updating the packages in this PR? I'm not sure what effect it might have on our CI tests, though. |
Thank you @kallehauge @kloon!! The details helped! I can reproduce your result. I did a
Then, I remember I upgraded my The "no fixable errors were found" issueIf we run
This issue (WordPress/WordPress-Coding-Standards#2203) is fixed in Solution
I have to first remove I updated the TestI did
I can confirm the 4 fixes and 21 remaining. Let me know if this doesn't work and I will look again. Thank you! |
Thanks @harriswong, should we also update QIT, PHPCS, phpcodesniffer-composer-installer, and woocommerce-sniffs? I also noticed that you updated wpcs to 3.0 where 3.1 is the latest version? The following command should update everyone to the latest versions fixing the dependency issues as well:
|
…/php_codesniffer wp-coding-standards/wpcs woocommerce/qit-cli dependencies
composer require -W --dev dealerdirect/phpcodesniffer-composer-installer
TIL about the Thanks! I gave this a try and then I ran
It looks like it's breaking from I tried skipping Then after that is done, I ran a separate Somehow, this works now! TestI did
Please take another look! |
Uh oh QIT failed. Checking 👀 |
I am going to rerun this. update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work as described! ❤️
composer phpcs woocommerce-services.php
returns:
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 20 WARNINGS AFFECTING 18 LINES
-------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [ ] Class file names should be based on the class name with "class-" prepended. Expected
| | class-wc-connect-loader.php, but found woocommerce-services.php.
| | (WordPress.Files.FileName.InvalidClassFileName)
...
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------
composer phpcbf woocommerce-services.php
returns:
-------------------------------------------------------------------------------------------------------------------
FILE FIXED REMAINING
-------------------------------------------------------------------------------------------------------------------
/Users/kallehauge/sites/escargot-dev-environment/woocommerce-services/woocommerce-services.php 4 21
-------------------------------------------------------------------------------------------------------------------
A TOTAL OF 4 ERRORS WERE FIXED IN 1 FILE
-------------------------------------------------------------------------------------------------------------------
All of the above matches the summary and latest comment from @harriswong 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes gives the results expected, thanks @harriswong!
Thanks for testing this out for me @kallehauge @kloon! I appreciate testing this on multiple different machines due to PHP/composer/etc. Merging. 🚀 |
Description
Running
composer phpcbf <file>
doesn't fix the file. Same forphpcs
. This PR fixes thelint-staged
script as well as thephpcbf
andphpcs
composer scripts. These will now check against the following standards--standard=WooCommerce-Core,WordPress-Core,WordPress-Extra
.Related issue(s)
N/A
Steps to test
composer phpcbf woocommerce-services.php
Checklist
changelog.txt
entry addedreadme.txt
entry added