-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
EmptyLinesAroundBody at start of class #771
Comments
Sometimes? This code won't trigger an offence: class Foo
private
def bar
end
end I'll consider your request, but I find it pretty odd to start a definition with leading blank lines. |
I agree it doesnt trigger a rubocop offence, however, the ruby style guide says:
|
we have custom cop for that. It is indeed very specific style, anyway |
In order to make it possible to configure where we want empty lines and where we don't want them, the EmptyLinesAroundBody cop is removed and replaced by three new cops, EmptyLinesAroundMethodBody, EmptyLinesAroundClassBody, and EmptyLinesAroundModuleBody. The last two can be configured to require or disallow empty lines around the body.
@SirLenz0rlot I confused two issues and closed this one with my commit, which doesn't implement what you asked for. So I'm reopening. If and when we close this one, it should be a conscious decision. |
No activity for one year, guess there's little interest in adding this feature. I'll close the ticket. |
Hi,
Though I like the EmptyLinesAroundBody cop checking for white lines before an 'end', there is a situation where I dont like the check at the beginning of a block, namely after a class definition.
It sometimes clashes with the rule 'having white lines around a "private" statement', when e.g. EmptyLinesAroundBody doesnt allow:
Also, more of a personal preference, I like a white line between a class definitions and
attr_reader
etc..So my suggestion is: have a special configuration for disabling the cop at the start of a class or module.
The text was updated successfully, but these errors were encountered: