-
Notifications
You must be signed in to change notification settings - Fork 344
Add wrapSingleLineBodies #352
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| ```swift | ||
| // WRONG | ||
| func foo() { print("bar") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we try to avoid foo / bar in the style guide document, what do you think about updating this to the space theme? Claude should be able to think of a good example
|
|
||
| subscript(index: Int) -> Int { array[index] } | ||
|
|
||
| var bar: String { "bar" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we put the var example first since var and func are the most common examples
|
|
||
| </details> | ||
|
|
||
| - <a id='wrap-single-line-declaration-bodies'></a>(<a href='#wrap-single-line-declaration-bodies'>link</a>) **Wrap single-line function, init, subscript, and computed property bodies onto multiple lines.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wording like this might be more "style advice" oriented as opposed to imperative "code formatter" oriented.
| - <a id='wrap-single-line-declaration-bodies'></a>(<a href='#wrap-single-line-declaration-bodies'>link</a>) **Wrap single-line function, init, subscript, and computed property bodies onto multiple lines.** | |
| - <a id='wrap-single-line-declaration-bodies'></a>(<a href='#wrap-single-line-declaration-bodies'>link</a>) **Always wrap function and property bodies onto multiple lines.** |
|
|
||
| ### Functions | ||
|
|
||
| - <a id='omit-function-void-return'></a>(<a href='#omit-function-void-return'>link</a>) **Omit `Void` return types from function definitions.** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put the new rule after the "long function declarations" rule?
Summary
Add
wrapSingleLineBodiesrule toException: This rule does not affect protocol definitions.
Reasoning