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

Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines should look outside of functions #851

Open
polybuildr opened this issue Jan 6, 2016 · 6 comments

Comments

@polybuildr
Copy link

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 (wikimedia/mediawiki-tools-codesniffer@3a6709b), and we were wondering if it could be upstreamed.

@aik099
Copy link
Contributor

aik099 commented Jan 6, 2016

This is checked indirectly by other sniffs, that require N lines (defaults to 1) to be between methods in a class.

@jkobus
Copy link

jkobus commented Nov 27, 2017

+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.

@VincentLanglet
Copy link
Contributor

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.

@Luc45
Copy link

Luc45 commented Jul 1, 2021

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?

@LasseRafn
Copy link

LasseRafn commented Feb 8, 2022

Any update here? I'd rather not bug my team about this and not all IDEs handle this automatically.

@ZoranMedojevic
Copy link

@LasseRafn @Luc45 This code did trick for me squizwhitespacefunctionspacing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants