-
Notifications
You must be signed in to change notification settings - Fork 8
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
CS: start using YoastCS 0.5 #69
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Add YoastCS - not fixed to a specific minor as for this repo any "stable" release should be fine. * Add the Dealerdirect Composer plugin to automatically sort out the PHPCS installed paths. Moved the `require-dev` section down to be directly after the `require` section for improved human-readability of the file.
…tandard The file is named `.phpcs.xml.dist` which allows for overruling the file with individual `phpcs.xml` and `.phpcs.xml` files. For that reasons, those files have been added to `.gitignore`. Also: activate checking against PHPCS once per Travis run.
Historically, this library uses `camelCaps` for variable names instead of the WP convention of using `snake_case`. There is no need to change this, we just need: * to allow for it, i.e. exclude the WPCS sniff; * make sure it's applied consistently, i.e. include a PHPCS sniff to check for this; * fix up the few exceptions to the rules - done in separate PRs.
Historically, this library uses `camelCaps` for function names instead of the WP convention of using `snake_case`. There is no need to change this, we just need: * to allow for it, i.e. exclude the WPCS sniff; * make sure it's applied consistently, i.e. include a PHPCS sniff to check for this and configure it; * exclude a few files which are justified exceptions.
Historically, this library uses a different convention for file names.
... and allow for non-prefixed globals in select test situations.
…nit test files I've chosen to exclude the errors for the `tests` directory in contrast to downgrading them to `warnings` for the complete plugin to prevent new documentation errors being introduced in the non-test code.
YoastCS uses PHP_CodeSniffer 3.x which has a minimum requirement of PHP 5.4. As the build check running PHPCS is run on PHP 7.2 and devs generally use a reasonably PHP version as well, this shouldn't be a problem. However, when installing from and/or validating the `composer.json` file during builds, Composer also tests all the scripts defined by the various packages and if this is done on PHP 5.3, the scripts for PHP_CodeSniffer will - predictably - fail. Removing PHPCS as a dependency for the non-PHPCS builds solves this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
This PR moves this repo onto YoastCS 0.5.
Please see the individual commits for details and complete documentation about the changes.
0.5.*
range.See WPCS Customizable sniff properties for detailed information.
1.0.0
release;Most of these issues have been excluded from being reported, though for one, the
error
has been downgraded to awarning
.Test instructions
This PR can be tested by following these steps:
vendor/bin/phpcs
without arguments to see that the library code is clean (other than the above mentioned warnings).