Skip to content
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

Merged
merged 2 commits into from
May 16, 2015
Merged

Add Core and Extra sniffs #382

merged 2 commits into from
May 16, 2015

Conversation

GaryJones
Copy link
Member

Adds a few Generic sniffs for Core, and a whole bunch more for Extra. See the diff for which sniffs.

<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't think we should include MultipleStatementAlignment. It's really annoying, for instance:

class-https-resource-proxy_php_-wordpress-develop-___projects_vvv_www_wordpress-develop

Copy link
Member

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

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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.
@GaryJones
Copy link
Member Author

Updated.

@JDGrimes JDGrimes added this to the 0.5.0 milestone May 16, 2015
JDGrimes added a commit that referenced this pull request May 16, 2015
@JDGrimes JDGrimes merged commit a7bf0b9 into develop May 16, 2015
@JDGrimes JDGrimes deleted the feature/more-sniffs branch May 16, 2015 22:11
jrfnl added a commit that referenced this pull request Jan 28, 2017
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.
jrfnl added a commit that referenced this pull request Feb 1, 2017
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.
jrfnl added a commit that referenced this pull request Feb 25, 2017
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.
jrfnl added a commit that referenced this pull request Feb 25, 2017
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.
jrfnl added a commit that referenced this pull request Oct 27, 2022
… 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
jrfnl added a commit that referenced this pull request Oct 27, 2022
… 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
jrfnl added a commit that referenced this pull request Oct 27, 2022
… 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants