Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Unexpected newline before opening brace for method calls with trailing closures #266

Open
andriichernenko opened this issue Oct 10, 2019 · 0 comments

Comments

@andriichernenko
Copy link

andriichernenko commented Oct 10, 2019

I tried formatting the project I'm working on with swift-format (using default configuration with 4-space indentation) and noticed that the following code:

return Presentation(editProduct, style: .modalOrFlip)
    .onValue {
        $0.map { self.libraryStore.edit(.add(.product($0))) }
    }
    .onPresent {
        isEditingLibrary.value = true
}

is formatted as

return Presentation(editProduct, style: .modalOrFlip)
    .onValue
{
    $0.map { self.libraryStore.edit(.add(.product($0))) }
}
    .onPresent
{
    isEditingLibrary.value = true
}

As I understand, this is done according to the rule 5 in the Line Wrapping section of the Swift Style Guide. In my opinion, however, newlines before opening braces are unnecessary in this case and should not be added.

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

No branches or pull requests

1 participant