-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Add sniff for consistent function spacing to extra
ruleset.
#593
Conversation
FYI: PR #597 fixes the conflict which looked to be a bug. |
IMHO there should never be a blank line after the last method in a class. The next line should have the class's closing brace on it. AFAIK that is the style that all of WordPress core's code follows (could be wrong though). Maybe that wasn't the best sniff to check for that, but at the very least I think it should be possible to configure WPCS so that it does flag blank lines after the last method in a class. So, I'm not saying that #597 has to be reverted, but maybe we should let that last-method check be toggled. And I wouldn't want to merge this until it was possible to have it not force a blank line after the last method in a class. |
As the sniff #597 relates to is about control structures, I don't think that should be solved there. Rather it should possibly be solved in this PR by either extending or copying the sniff this PR would add and changing it's behaviour for the last method of a class. All the same, personally I don't agree with the |
There doesn't need to be - the indentation of the first method (DocBlock) does the same job as a Blank line. I never have closing blank line at the start or end of classes. |
So... shall we just add this to the ruleset used for WPCS itself ? and close this PR/not add it to the WPCS |
I think that there is some agreement on the "1 blank line between functions" rule, but the "before the first" and "after the last" part doesn't have a consensus, and I guess isn't currently address by WordPress's coding standards. So I guess unless that upstream sniff can be configured to only check between functions/methods, we'll close this PR. |
I agree with closing this for WPCS, but what about this:
I know we don't all agree with it, but it is how I've done it (for now) in the clean up. The reason why I'm asking is that with the Theme Check sniffs being created now, it would be good to have them auto-checked for some consistency in the function spacing rather than leaving that up to the individual developer. What do think ? Shall I open a separate PR for just adding it to the WPCS "own" ruleset ? |
I lean towards not, but if others want to, I'm indifferent. 😄 |
FYI: there is already an open PR at PHPCS to remove the check after the last function/method in a file: squizlabs/PHP_CodeSniffer#1041 |
dec98c3
to
c7828eb
Compare
c7828eb
to
8b073c7
Compare
8b073c7
to
93becfe
Compare
93becfe
to
11ec979
Compare
11ec979
to
9591d3e
Compare
Suggest closing for lack of activity/interest. |
|
See #590 (comment)
Please note: