-
Notifications
You must be signed in to change notification settings - Fork 1k
Implement CS checking based on the WP_CLI_CS ruleset
#5198
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
Conversation
|
Tackling that last remaining issue now... |
d152ec1 to
8ff6282
Compare
|
Rebased now #5199 has been merged. Fingers crossed the build should pass. |
|
@jrfnl Looks like it is failing on a bug in PHPCS: https://travis-ci.org/wp-cli/wp-cli/jobs/523862847#L595 |
... as that version contains the new WP_CLI_CS PHPCS standard. Includes updating the `composer.lock` file with `composer update wp-cli/wp-cli-tests --with-all-dependencies` which resulted in the following updates: ``` - Removing phpcompatibility/phpcompatibility-wp (1.0.0) - Updating wp-coding-standards/wpcs (1.2.1 => 2.1.0): Loading from cache - Updating wp-cli/eval-command (v2.0.3 => v2.0.4): Loading from cache - Updating wp-cli/config-command (v2.0.2 => v2.0.3): Loading from cache - Updating phpcompatibility/php-compatibility (8.2.0 => 9.1.1): Loading from cache - Removing wp-cli/wp-cli-tests (v2.0.13) - Installing wp-cli/wp-cli-tests (v2.1.1): Loading from cache - Updating roave/security-advisories (dev-master 9c6c45a => dev-master 1b329f4) ```
* Remove refs which shouldn't be in this file.
- The `phpunit.xml.dist` file shouldn't be ignored.
- The two directory entries look like personal ones which shouldn't have gotten into the `.gitignore` file in the first place, but should have been put into someone's personal `.git/info/exclude` file.
* Add files which allow devs to overwrite config files for PHPUnit and PHPCS
- The `.dist` files should be committed. However, for their personal use, devs can overrule those files with versions without `.dist`.
Those personal versions should never be committed.
As a side-note: for PHPCS, having a personal version while still using the original `.dist` file is made very easy, as you can just import the `.dist` file as a starting point, like so:
```xml
<?xml version="1.0"?>
<ruleset name="WP-CLI">
<rule ref="./phpcs.xml.dist"/>
</ruleset>
```
8ff6282 to
3bda68a
Compare
My bad. I whitelisted the wrong file: https://github.com/wp-cli/wp-cli/pull/5198/files#diff-6758ef1f416bd888bd1a5cad8f97cc2bR119 Should be fixed now. |
The file is completely documented in-line.
…ents The WPCS native whitelist comments have been deprecated in WPCS 2.0 and will be removed in 3.0, in favour of the PHPCS native selective ignore comments which were introduced in PHPCS 3.2.
3bda68a to
7e12cae
Compare
|
LOL Ok, so I hadn't whitelisted the wrong file, except since I last scanned, the same issue is now being reported for a second file.... As this relates to a bug in PHPCS itself, I've now just chosen to exclude that complete error code for the time being with a note that that exclusion should be removed once PHPCS 3.5.0 has been released and starts to be used. |
|
Builds are ✔️ 🎉 |
This basically updates the PHPCS ruleset to use the new
WP_CLI_CSstandard and adds a number of whitelist comments and exclusions.As annotated in issue #5166, there is currently only one issue still remaining to be fixed:
Please see the individual commits for more detail.
N.B.: In contrast to some of my other PRs, the commits in this PR should probably not be squashed.
Fixes #5166
Relates to #5179
Commit summary
Composer: use wp-cli-tests ^2.1
... as that version contains the new WPCliCS PHPCS standard.
Includes updating the
composer.lockfile withcomposer update wp-cli/wp-cli-tests --with-all-dependencieswhich resulted in the following updates:.gitignore: ignore correct phpcs/phpunit config files
phpunit.xml.distfile shouldn't be ignored..gitignorefile in the first place, but should have been put into someone's personal.git/info/excludefile..distfiles should be committed. However, for their personal use, devs can overrule those files with versions without.dist.Those personal versions should never be committed.
As a side-note: for PHPCS, having a personal version while still using the original
.distfile is made very easy, as you can just import the.distfile as a starting point, like so:PHPCS: update the ruleset/defer to WPCliCS
The file is completely documented in-line.
PHPCS: replace some old-style whitelist comments with new-style
PHPCS: replace some WPCS whitelist comments with PHPCS whitelist comments
The WPCS native whitelist comments have been deprecated in WPCS 2.0 and will be removed in 3.0, in favour of the PHPCS native selective ignore comments which were introduced in PHPCS 3.2.
PHPCS: remove some redundant old-style ignore comments
PHPCS: whitelist some code for select sniffs
Depends on #5199