-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Add Core and Extra sniffs #382
Conversation
<rule ref="Generic.PHP.ForbiddenFunctions"/> | ||
<rule ref="Generic.Functions.CallTimePassByReference"/> | ||
<rule ref="Generic.Formatting.DisallowMultipleStatements"/> | ||
<rule ref="Generic.Formatting.MultipleStatementAlignment"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it previously: 9f6854d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, MultipleStatementAlignment
is a good practice within reason, but the sniff isn't refined enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I'd optionally put $redirect_vars_pairs
above line 129, and align the =
out.
In other cases, just adding a clear line above 134 would do - that the separates the predefined data in $redirect_vars
, and the variable that's only populated from the foreach
.
It is part of the standard.
However, I'm open to removing it if you both still insist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is part of the standard.
Kinda. It says “spaces can be used mid-line for alignment”. It doesn't say that that alignment is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably have in the README
a list of other sniffs that users may like to opt-in to, such as this, but which are perhaps even more opinionated than Extra already is.
Left in and commented out with a note so that future us will know why it's been excluded.
Updated. |
…sniffs Add Core and Extra sniffs
The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment) To this end, I've send in a PR upstream to address these concerns, which has subsequently been merged. The adjusted version of the sniff will be released in PHPCS 2.7.2.
The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment) To this end, I've send in a PR upstream to address these concerns, which has subsequently been merged. The adjusted version of the sniff will be released in PHPCS 2.7.2.
The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment) To this end, I've send in a PR upstream to address these concerns, which has subsequently been merged. The adjusted version of the sniff will be released in PHPCS 2.7.2.
The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment) To this end, I've send in a PR upstream to address these concerns, which has subsequently been merged. The adjusted version of the sniff will be released in PHPCS 2.7.2.
… sniff. The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment), also see 522b35f To this end, I've send in a [PR upstream](squizlabs/PHP_CodeSniffer#1318) to address these concerns, which has subsequently been merged. The adjusted version of the sniff was released in PHPCS 3.4.0, which means the sniff can now be added. Note: the sniff has since then also been adjusted to handle arrow functions correctly, as well as constructor property promotion. Fixes 1510
… sniff The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment), also see 522b35f To this end, I've send in a [PR upstream](squizlabs/PHP_CodeSniffer#1318) to address these concerns, which has subsequently been merged. The adjusted version of the sniff was released in PHPCS 3.4.0, which means the sniff can now be added. Note: the sniff has since then also been adjusted to handle arrow functions correctly, as well as constructor property promotion. Fixes 1510
… sniff The reason why the sniff was disabled up to now was that WP uses callbacks a lot and the hooked in functions may not use all parameters passed to them. This concern was previously raised in #382 (comment), also see 522b35f To this end, I've send in a [PR upstream](squizlabs/PHP_CodeSniffer#1318) to address these concerns, which has subsequently been merged. The adjusted version of the sniff was released in PHPCS 3.4.0, which means the sniff can now be added. Note: the sniff has since then also been adjusted to handle arrow functions correctly, as well as constructor property promotion. Fixes 1510
Adds a few Generic sniffs for Core, and a whole bunch more for Extra. See the diff for which sniffs.