-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Ordering of the rules in the rulesets #602
Comments
Agreed. |
As good an order as any. |
Re-ordering now and running into some sniffs which are not in the handbook (or at least: I've not been able to find them).
I'd suggest: While it goes without saying that code shouldn't have parse errors, there is also the thing about supporting multiple PHP versions (5.2-7.1-alpha+HHVM). So maybe this should actually be moved to
I'd suggest: Make this explicit in the handbook.
I'd suggest: Make this explicit in the handbook. Opinions ? |
There are lots of things we'd like to see made explicit in the handbook - certainly these are some of the less controversial - but there's no established process from getting buy in from the powers that be. |
|
@DrewAPicture may be able to help us. |
Honestly, if it were up to me I probably wouldn't include that sniff at all. If you are using PHPCS along with other tools (like your IDE) you'll already be checking syntax anyway. This sniff then unnecessarily duplicates that, wasting time and resources. I'd prefer it to at least be moved to
WordPress core contributors who have write access to the handbook. WPCS has no control over WordPress's standards, and never has. Maybe it's about time that we started coordinating more though... |
Sounds like a plan 👍 |
Ok, nearly done. The Handbook rule relating to Formatting SQL statements is for the most part covered by the |
I've tried at least twice to have a separate channel created in the WP Slack, for WPCS discussions (at least to see who has a vested interested in discussing it), as a way to move things forward. I've been told both times that it doesn't warrant it's own channel, and that the main core dev channel should be used instead (despite the fact these standards are meant for a lot more people than core). So feature plugins and other topics get their own channel, to save discussions getting lost amongst everything else, but something which affects (or should affect) every single core, theme and plugin developer, doesn't. There are so many holes in the Handbook re CS, that even if we did sniff 100% accurately, there would still be a wide range of coding styles. The Handbook simply isn't prescriptive enough to sufficiently cover all the cases in a way that I think it should. I'm open for ideas from @DrewAPicture and @westonruter about how we can get Core committer buy-in on this to move the Handbook forward (or get new WP commits run against WPCS via Travis i.e. this commit from two days ago would fail the check when it was an easy win to make it pass), so that we've all got something comprehensive to work against. |
I do have a ticket with a patch that would add PHPCS to Travis CI checks for WordPress Core commits, checking the errors reported among lines changed instead of against the entire codebase: https://core.trac.wordpress.org/ticket/34694 (uses same code as is now in wp-dev-lib). I need to update the patch. |
Anyone an opinion about my previous question:
|
@jrfnl not sure. Perhaps the rules weren't part of the handbook at that time. |
This is probably what happened. As I'm sure we're all aware, the handbook isn't codified, it's constantly being refined. So it's very possible that it changed since the sniff was written. |
So shall I move it over to |
@jrfnl better to ask for forgiveness than permission 😉 |
This PR does not add or remove any new rules, it just re-orders the core ruleset to follow the handbook and documents the rules as they are in the handbook - both covered and not covered. Closes #602 For any core rules which are not yet covered, but *could* possibly *be* covered, a new issue has been opened if one didn't exist already and the link to the issue is included in the ruleset. Rules included, but not (explicitly) covered in the handbook are listed in their own section at the bottom of the ruleset. I've made three changes which should be noted: * Removed the `WordPress.WP.I18n` sniff from the `extra` ruleset as it is included in the `core` ruleset and `core` is included in `extra`. * Moved the `WordPress.WP.PreparedSQL` sniff from `extra` to `core` as the checks included in that sniff are actually part of the core rules. * Moved the `Generic.PHP.Syntax` to `extra` as IRL often enough there will be code which will only be loaded for higher PHP versions with a wrapper and fall-backs for lower PHP versions. Feedback welcome. Review is probably easiest by just looking at the new version of the file as the diff will be horrible ;-)
This PR does not add or remove any new rules, it just re-orders the core ruleset to follow the handbook and documents the rules as they are in the handbook - both covered and not covered. Closes #602 For any core rules which are not yet covered, but *could* possibly *be* covered, a new issue has been opened if one didn't exist already and the link to the issue is included in the ruleset. Rules included, but not (explicitly) covered in the handbook are listed in their own section at the bottom of the ruleset. I've made three changes which should be noted: * Removed the `WordPress.WP.I18n` sniff from the `extra` ruleset as it is included in the `core` ruleset and `core` is included in `extra`. * Moved the `WordPress.WP.PreparedSQL` sniff from `extra` to `core` as the checks included in that sniff are actually part of the core rules. * Moved the `Generic.PHP.Syntax` to `extra` as IRL often enough there will be code which will only be loaded for higher PHP versions with a wrapper and fall-backs for lower PHP versions. Feedback welcome. Review is probably easiest by just looking at the new version of the file as the diff will be horrible ;-)
This PR does not add or remove any new rules, it just re-orders the core ruleset to follow the handbook and documents the rules as they are in the handbook - both covered and not covered. Closes #602 For any core rules which are not yet covered, but *could* possibly *be* covered, a new issue has been opened if one didn't exist already and the link to the issue is included in the ruleset. Rules included, but not (explicitly) covered in the handbook are listed in their own section at the bottom of the ruleset. I've made three changes which should be noted: * Removed the `WordPress.WP.I18n` sniff from the `extra` ruleset as it is included in the `core` ruleset and `core` is included in `extra`. * Moved the `WordPress.WP.PreparedSQL` sniff from `extra` to `core` as the checks included in that sniff are actually part of the core rules. * Moved the `Generic.PHP.Syntax` to `extra` as IRL often enough there will be code which will only be loaded for higher PHP versions with a wrapper and fall-backs for lower PHP versions. Feedback welcome. Review is probably easiest by just looking at the new version of the file as the diff will be horrible ;-)
Each time I'm currently adding a rule, I keep wondering where to put it - beginning of file, end of file, somewhere near a related rule ?
What about re-ordering the
core
ruleset to follow the sections of the handbook ? That way things have a logical place and it'll be more easy to check what is and isn't covered yet from the handbook.Opinions ?
The text was updated successfully, but these errors were encountered: