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

Expected 0 spaces between "(" and comma; 1 found - false positive ? #132

Merged
merged 2 commits into from
Dec 11, 2013

Conversation

westonruter
Copy link
Member

I'm receiving this error for a certain project and can't for the life of me figure out what is meant by it and/or how it applies to the indicated lines.

Not sure whether this is a false positive or whether I'm just being stupid ;-) On that note, there are a few other projects where I'm getting strange (unexplainable) sniff errors from, again possibly false positives. Should these be reported here ? I couldn't find anything about it in the contributing notes.

Below are the lines causing the errors (from the Mimetype Link Icons plugin and used in a function which returns the input used for wp_localize_script() ):

$strings = array(
    'hidethings'            => ( ( true === $this->settings['enable_hidden_class'] && ( is_array( $this->settings['hidden_classname'] ) && array() !== $this->settings['hidden_classname'] ) ) ? true : false ),
    'enable_async'          => ( ( true === $this->settings['enable_async'] && ( is_array( $this->active_mimetypes ) && array() !== $this->active_mimetypes ) ) ? true : false ),
    'enable_async_debug'    => ( ( true === $this->settings['enable_async_debug'] && ( is_array( $this->active_mimetypes ) && array() !== $this->active_mimetypes ) ) ? true : false ),
);

@westonruter
Copy link
Member

It does seem to be a false positive (or negative)?

Here is the code in question which flags the error: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/e16ca46b6df78dcf45cc2af588907d14fc57184a/Sniffs/Arrays/ArrayDeclarationSniff.php#L428-L434

@westonruter
Copy link
Member

@shadyvb when you have a moment, can you debug this?

@ghost ghost assigned shadyvb Dec 2, 2013
@shadyvb
Copy link
Contributor

shadyvb commented Dec 11, 2013

@westonruter I think it was a left-over from a previous ticket, with some faulty unit-test which was modified later. Undoing the fix of #59 did not break unit tests but it solves this ticket here.

westonruter added a commit that referenced this pull request Dec 11, 2013
…tion-comma-check-fail

Fix false positive: Expected 0 spaces between "(" and comma; 1 found
@westonruter westonruter merged commit b46eeda into master Dec 11, 2013
@jrfnl
Copy link
Member Author

jrfnl commented Dec 12, 2013

@shadyvb @westonruter Thank you!

@westonruter westonruter deleted the array-declaration-comma-check-fail branch October 12, 2014 18:06
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this pull request Jun 11, 2018
…pa-version

New sniff: Verify that an up-to-date version of TGMPA is being used.
@GaryJones GaryJones added this to the 0.3.0 milestone Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants