Skip to content
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

Update opening_brace for multiline if statements #3720

Open
2 tasks done
Juice805 opened this issue Sep 16, 2021 · 1 comment · May be fixed by #5521
Open
2 tasks done

Update opening_brace for multiline if statements #3720

Juice805 opened this issue Sep 16, 2021 · 1 comment · May be fixed by #5521

Comments

@Juice805
Copy link

Juice805 commented Sep 16, 2021

New Issue Checklist

Rule update request

Similar to #3068 I'd like to propose a change to opening_brace to allow the following format:

if let child = parent.children.first,
    let grandchild = child.children.first,
    let greatGrandchild = grandchild.children.first
{
    // Some code
}

or

if 
    let child = parent.children.first,
    let grandchild = child.children.first,
    let greatGrandchild = grandchild.children.first
{
    // Some code
}

Currently the autocorrect will fix it to the following which is difficult to read:

if 
    let child = parent.children.first,
    let grandchild = child.children.first,
    let greatGrandchild = grandchild.children.first {
    // Some code
}
@Juice805
Copy link
Author

looks like while also has this issue and should be included:

while 
    let child = parent.children.first,
    let grandchild = child.children.first,
    let greatGrandchild = grandchild.children.first
{
    // Some code
}

guard does not assuming this structure:

guard
    let child = parent.children.first,
    let grandchild = child.children.first,
    let greatGrandchild = grandchild.children.first
else {
    // Some code
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants