realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.45k stars 2.2k forks source link

`opening_brace` now triggers on multiline if statements #5602

Open michaeleustace opened 1 month ago

michaeleustace commented 1 month ago

New Issue Checklist

Describe the bug

To be consistent with other multiline bracket rules, when we have a multiline if statement we put the opening brace on a new line. Before the rewrite using SwiftSyntax, this usage was never triggered. Now, however it is.

Could this usage either be prevented from triggering the rule, or at least have a configuration option to ignore such cases.

Environment

# insert yaml contents here
// This does not trigger violation
guard
    condition1,
    let var1 = var1
else {
...

// This triggers a violation:
if
    condition1,
    let var1 = var1
{
SimplyDanny commented 3 weeks ago

There is #5521 to make this optional.