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

Fix custom properties whitelist in valid variable name sniff #839

Closed
wants to merge 1 commit into from

Conversation

JDGrimes
Copy link
Contributor

@JDGrimes JDGrimes commented Feb 9, 2017

The value of the customPropertiesWhitelist property of the WordPress.NamingConventions.ValidVariableName sniff was always being discarded. This is because the logic that was intended to only be dealing with a non-array value was actually being applied even when the value was properly set as an array. (See line 299.) I noticed this while running against a rulseset that utilizes this property, and so I fixed it, and now it is working properly.

Apparently this isn't covered by the tests, which only cover the sniffs themselves and not rulesets. Not sure if there is a way to remedy that right now or not.

The value of the `customPropertiesWhitelist` property of the `WordPress.NamingConventions.ValidVariableName` sniff was always being discarded. This is because the logic that was intended to only be dealing with a non-array value was actually being applied even when the value was properly set as an array. I noticed this while running against a rulseset that utilizes this property, and so I fixed it, and now it is working properly.

Apparently this isn't covered by the tests, which only cover the sniffs themselves and not rulesets. Not sure if there is a way to remedy that right now or not.
@jrfnl
Copy link
Member

jrfnl commented Feb 10, 2017

@JDGrimes I've got a PR ready (waiting for #833 to be merged) which will actually fix this for all sniffs using custom lists which need to be merged. If you don't mind, I'd be inclined to close this one in favour of the more comprehensive one I've got waiting to be pulled. Oh and it includes unit tests ;-)
See: https://github.com/jrfnl/WordPress-Coding-Standards/commits/WAIT-833/WPCS/feature/better-custom-property-handling

@jrfnl
Copy link
Member

jrfnl commented Feb 10, 2017

@JDGrimes Oh and it would be nice if #818 could be merged too as there might be some overlap otherwise ;-)

@jrfnl
Copy link
Member

jrfnl commented Feb 11, 2017

Ok, the above mentioned branch has now been pulled as PR #841

@jrfnl
Copy link
Member

jrfnl commented May 15, 2017

@JDGrimes Just doing some clean up. Can I delete this branch ?

@JDGrimes JDGrimes deleted the bugfix/custom-properties-whitelist branch May 15, 2017 12:11
@JDGrimes JDGrimes removed this from the 0.11.0 milestone May 15, 2017
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.

3 participants