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

opening_brace now triggers on multiline if statements #5602

Open
2 tasks done
michaeleustace opened this issue May 23, 2024 · 1 comment · May be fixed by #5521
Open
2 tasks done

opening_brace now triggers on multiline if statements #5602

michaeleustace opened this issue May 23, 2024 · 1 comment · May be fixed by #5521
Labels

Comments

@michaeleustace
Copy link

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

  • SwiftLint version (run swiftlint version to be sure)? 0.55.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Cocoapods
  • Paste your configuration file:
# insert yaml contents here
  • Are you using nested configurations? No
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? 15.3
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
// This does not trigger violation
guard
    condition1,
    let var1 = var1
else {
...

// This triggers a violation:
if
    condition1,
    let var1 = var1
{
@michaeleustace michaeleustace changed the title opening_brace now triggers on multiline if statements opening_brace now triggers on multiline if statements May 23, 2024
@SimplyDanny
Copy link
Collaborator

There is #5521 to make this optional.

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