Update to WPCS 3.0.0
danielbachhuber opened this issue · comments
WPCS 3.0.0 was recently released. We should update WP-CLI to use it!
- wp-cli/automated-tests
- wp-cli/admin-command
- wp-cli/cache-command
- wp-cli/checksum-command
- wp-cli/config-command
- wp-cli/core-command
- wp-cli/cron-command
- wp-cli/db-command
- wp-cli/dist-archive-command
- wp-cli/doctor-command
- wp-cli/embed-command
- wp-cli/entity-command
- wp-cli/eval-command
- wp-cli/export-command
- wp-cli/extension-command
- wp-cli/find-command
- wp-cli/i18n-command
- wp-cli/import-command
- wp-cli/language-command
- wp-cli/maintenance-mode-command
- wp-cli/media-command
- wp-cli/package-command
- wp-cli/php-cli-tools
- wp-cli/profile-command
- wp-cli/restful
- wp-cli/rewrite-command
- wp-cli/role-command
- wp-cli/scaffold-command
- wp-cli/scaffold-package-command
- wp-cli/search-replace-command
- wp-cli/server-command
- wp-cli/shell-command
- wp-cli/snapshot-command
- wp-cli/super-admin-command
- wp-cli/widget-command
- wp-cli/wp-cli
- wp-cli/wp-cli-bundle
- wp-cli/wp-cli-dev
- wp-cli/wp-cli-tests
- wp-cli/wp-cli.github.com
- wp-cli/wp-config-transformer
- wp-cli/wp-super-cache-cli
Done is:
- This repository is updated to WPCS 3.0.0.
- All of our repositories are updated to the latest version of this test package and passing.
This can be run from the wp-cli-dev
repo to quickly assess all packages:
./foreach-bundle "composer require --quiet --dev wp-cli/wp-cli-tests:^4"
./foreach-bundle "composer phpcs"
This way we can identify additional things we might want to add to the default PHPCS config, like for example https://github.com/wp-cli/wp-cli-tests/pull/176/files#r1310157136
At first glance it appears that most of the errors can be auto-fixed, reducing the amount of manual work involved with updating.
Edit: looks like you already tagged a new release; so I updated the command accordingly.
I'm getting an odd warning with phpcbf
...
$ composer phpcbf
> run-phpcbf-cleanup
Deprecated: Creation of dynamic property WordPressCS\WordPress\Sniffs\PHP\NoSilencedErrorsSniff::$use_default_whitelist is deprecated in /Users/danielbachhuber/Desktop/admin-command/vendor/squizlabs/php_codesniffer/src/Ruleset.php on line 1331
. 1 / 1 (100%)
Edit: looks like you already tagged a new release; so I updated the command accordingly.
Yeah, I had to tag in order to start updating the dependencies.
This way we can identify additional things we might want to add to the default PHPCS config, like for example https://github.com/wp-cli/wp-cli-tests/pull/176/files#r1310157136
Want to submit a PR for that?
I'm getting an odd warning with
phpcbf
...
You need to renameuse_default_whitelist
to usePHPFunctionsList
here:
wp-cli-tests/WP_CLI_CS/ruleset.xml
Lines 112 to 116 in bd3f6d6
Want to submit a PR for that?
I think we can do all of these ruleset updates in a single PR
I think we can do all of these ruleset updates in a single PR
@swissspidy Sure... are you doing that?
Started a PR here: #177
This can be run from the wp-cli-dev repo to quickly assess all packages [...]
I also use that script for doing things like this in a case like the above (built from memory and untested):
./foreach-bundle "git checkout -b fix/wpcs-3.0-issues"
./foreach-bundle "composer require --quiet --dev wp-cli/wp-cli-tests:^4 -W"
./foreach-bundle "git add composer.*"
./foreach-bundle "git commit -m 'Update to WPCS v3'"
./foreach-bundle "vendor/bin/phpcbf"
./foreach-bundle "git add --all"
./foreach-bundle "git commit -m 'Fix all autofixable CS issues'"
./foreach-bundle "hub pull-request -m 'Update to WPCS v3' -l 'scope:testing' -m 'Auto-generated PR that updates WPCS to the latest v3 and then runs PHPCBF to fix all automatically fixable issues.'"
This will create a pull request in each bundle repository. Those that pass their tests can be merged right away, the others will be starting points for additional commits to fix any remaining issues.
This has been the most scalable way for working on bundle-wide changes for me.
I can run the above (and adapt as needed to create all initial PRs now. Let me do those, and then we can see what else might still need fixing.
🎉