-
Notifications
You must be signed in to change notification settings - Fork 618
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
[Suggestion] Empty Line Inside Out-Most Brackets Rule #20
Comments
This would be in conflict with the This looks wrong to me.
I feel like it should be
But I haven't managed to come up with a rule for blank lines at the beginning of a scope. Normally I remove them, but there are exceptions, e.g. in a class. I may need to make this configurable if people feel strongly about it. |
The enum Foo {
case a, b, c
func bar() {
// Do something here
}
func baz() {
// Do something else here
}
} If I understand it correctly, Making this configurable sounds like a good idea! |
Sometimes I write functions like this:
I won't add empty line inside |
to this:
|
I get what you're saying about scopes at root level possibly requiring different treatment than ones that are nested. You might be right, but I still don't think I know what the rule should be yet. I'll think about it some more. |
I've decided to take a different approach. I'm now adding space between functions, classes, etc regardless of scope. May not be popular with everyone, but we'll see. |
Sounds good. In this case maybe Btw, what about properties? |
I'm pretty happy with not having a blank line at the end of a scope. Since the scope always ends with a } and a lower indent level than the previous line, there's never any visual overlap:
I'm not sure if I like the blank line at the start of a scope or not, which is why I current ignore it. I may eventually make this configurable though.
I haven't worked out what to do about those yet. I definitely don't want to put blank lines between them, but I'd like to separate groups of them from a previous function, e.g.
|
I agree. |
Have you work this case out? |
Add extra line after
{
and before}
only for brackets without any indentation.It is common to write code like this:
or:
The text was updated successfully, but these errors were encountered: