PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines should look outside of functions
Currently, Squiz.WhiteSpace.SuperfluousWhitespace
only looks inside functions for EmptyLines
, but aren't multiple empty lines a concern even outside of functions?
The MediaWiki codesniffer standard recently had this implemented as a custom sniff (https://github.com/wikimedia/mediawiki-tools-codesniffer/commit/3a6709be2612fad63b9e9ead4e6644c28748edcc), and we were wondering if it could be upstreamed.
This is checked indirectly by other sniffs, that require N lines (defaults to 1) to be between methods in a class.
+1 on this one. It''s working only in methods.
Right now it can be used as:
<ruleset ...>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"/>
</ruleset>
You would expect it to work in a context of a class.
MediaWiki sniff linked above works like a charm.
This is checked indirectly by other sniffs, that require N lines (defaults to 1) to be between methods in a class.
There is missing checks since there is no check between constants or comments for example.
This is checked indirectly by other sniffs, that require N lines (defaults to 1) to be between methods in a class.
Thanks, do you remember which sniff is it?
Any update here? I'd rather not bug my team about this and not all IDEs handle this automatically.