[wp-trac] [WordPress Trac] #45934: Coding Standards: Manual Fixes
WordPress Trac
noreply at wordpress.org
Sat Jan 12 04:54:27 UTC 2019
#45934: Coding Standards: Manual Fixes
----------------------------+-------------------------------
Reporter: pento | Owner: pento
Type: task (blessed) | Status: assigned
Priority: low | Milestone: 5.1
Component: General | Version:
Severity: minor | Resolution:
Keywords: | Focuses: coding-standards
----------------------------+-------------------------------
Comment (by jrf):
@pento Thanks for opening this ticket and getting the ball rolling on
this.
I've had a quick look through the ticket and left one remark inline on GH:
https://github.com/WordPress/wordpress-
develop/commit/8cc49330a4f812d0d374dc49b703ad2704139af0#r31916991
(partially the same as @GaryJ's remark which has already been fixed,
sorry).
Re: https://core.trac.wordpress.org/changeset/44571 - Just wondering: why
would the Gutenberg plugin not be expected to comply with the WP Coding
Standards ? (first two excludes, the third for external file is of course
perfectly fine)
Regarding **Yoda conditions** - we've talked about this before. IMO this
rule should be dropped in favour of the "No assignment in condition" rule
and the associated sniff
`WordPress/Generic.CodeAnalysis.AssignmentInCondition` which is currently
in `Extra` should be moved to `Core`.
At the time you asked me to investigate whether there is a sniff available
out there which could revert existing Yoda conditions. The answer to that
is "Yes".
The external [Slevomat Coding Standard](https://github.com/slevomat
/coding-
standard#slevomatcodingstandardcontrolstructuresdisallowyodacomparisonrequireyodacomparison-)
contains a sniff which can auto-fix Yoda to non-Yoda. Tests could (should)
be run to see how well it works, but this sniff could be used in a one-
time action to move away from Yoda.
Note: if the sniff would not be good enough/would turn out to be buggy,
I'm happy to contribute fixes to the Slevomat standard just to make moving
away from Yoda possible.
Having said that, as the tooling is available which would allow us to move
away from Yoda and still prevent assignments in conditions, would strongly
suggest now is a good time to take a decision on this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45934#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list