-
Notifications
You must be signed in to change notification settings - Fork 69
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
Update phpcs and related sniffs #8415
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: +6 B (0%) Total Size: 1.2 MB
ℹ️ View Unchanged
|
These are the rules that have issues reported after updating the sniffs:
And some leftovers fixed in b6301d6. So those are all rules we have to make a decision on. I found these by writing the phpcs report to json and using ./vendor/bin/phpcs --standard=phpcs.xml.dist (git ls-files | grep '.php$') --report=json > issues.json
vi issues.json # And remove the empty lines and PHPCS report
cat issues.json | jq '.. |."source"? | select(. != null )' | sort | uniq |
I've been working through the list but it's taking a bit of time. I've settled on trying to use
./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep '.php$') --sniffs='PSR12.Functions.ReturnTypeDeclaration'
./vendor/bin/phpcbf --standard=phpcs.xml.dist $(git ls-files | grep '.php$') --sniffs='PSR12.Functions.ReturnTypeDeclaration'
@bborman22 this is taking longer than it's expected, but I think it's important that we get this done because:
The longer this drags the harder it will be to merge due to the amount of files this touches. The things we can't auto-fix via Note that all of these issues appeared after I updated the sniffs and PHPCS, they were not present before. @ricardo I've already seen some things that will probably need to discuss:
Probably some others similar to this, or maybe ones we have to fix, but this is as far as I've gotten today. |
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.
PHP lint works well with PHP 8.1 now. While I see a lot of warnings and errors, I think it's fine to merge and address the rest separately.
Awesome! I just merged from I'll wait for tests to pass and add a changelog entry before I merge. |
Changes proposed in this Pull Request
Testing instructions
Note
There are currently way more issues reported after the update. Not sure which ones are false positives, which can be silenced, and which ones we should fix.
npm run lint:php
indevelop
and make a note of the issues reported (there should be none)./opt/homebrew/opt/[email protected]/bin/php ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep .php$)
composer install
.npm run lint:php
and make sure you see the same issues reported as indevelop
.npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge