xwp / WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
MIT License
29 stars 3 forks source link

} else { //Are we allowed to comment here? If not, message is wrong #28

Closed mwic closed 11 years ago

mwic commented 11 years ago

I make frequent use of comments on else control structures , so that I don't have to scroll around to see what condition is being else'd. e.g. if ( $parrotIsAlive ) { [snip] } else { //parrot has ceased to be [snip] }

With your standard I get a misleading message on this attempt. "Blank line found at start of control structure" Whether or not the comment is allowed, the message needs to be fixed

Full writeup: http://mwic.org/wp/index.php/blank-line-found-at-start-of-control-structure-when-there-isnt-a-blank-line-there

westonruter commented 11 years ago

@mwic Could you copy/paste the exact snippet into a gist or somewhere that preserves formatting?

But yeah, I think that the WordPress.WhiteSpace.ControlStructureSpacing sniff needs to be tweaked to be a little smarter about the control-structure formatting.

mwic commented 11 years ago

https://gist.github.com/mwic/5248309

westonruter commented 11 years ago

Moved to https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/36