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

multiline_arguments_brackets requires last tailing closure to contain a newline #4510

Closed
2 tasks done
CraigSiemens opened this issue Nov 3, 2022 · 0 comments · Fixed by #4512
Closed
2 tasks done

Comments

@CraigSiemens
Copy link
Contributor

New Issue Checklist

Describe the bug

It seems like the multiline_arguments_brackets assumes that the end of the callBody is still within the parenthesis for the arguments.

In the case where call contains a trailing closure, the rule will generate a false positive when the closure is a single line.

In the case where the call contains multiple trailing closure, the rule will generate a false positive when the last trailing closure is a single line. Earlier trailing closures can be one one or multiple lines and it wont affect the results.

Complete output when running SwiftLint, including the stack trace and command used
➜ swiftlint lint example.swift --no-cache --enable-all-rules 
Linting Swift files at paths example.swift
Linting 'example.swift' (1/1)
The `anyobject_protocol` rule is now deprecated and will be completely removed in a future release.
/Users/neo/Desktop/example.swift:3:25: warning: Multiline Arguments Brackets Violation: Multiline arguments should have their surrounding brackets in a new line. (multiline_arguments_brackets)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.50.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? home-brew
  • Paste your configuration file: n/a
  • Are you using nested configurations? No
  • Which Xcode version are you using (check xcodebuild -version)? 14.1
  • Do you have a sample that shows the issue? Yes
echo "SomeType(\n    a: 1\n) { print("completion") }" | swiftlint lint --no-cache --use-stdin --enable-all-rules
SomeType(
    a: 1
) { print("completion") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant