You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func myFunc1(
a1 _:Int,
a2 _:(Int)->Void,
a3 _:String,
a4 _:(String)->Void){}
// This function triggers a violation:
// warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)
func myFunc2(){myFunc1(
a1:1,
a2:{ _ in},
a3:"2",
a4:{ _ in})}
// If I try using trailing closure, I get:
// Multiple Closures with Trailing Closure Violation: Trailing closure syntax should not be used when passing more than
// one closure argument (multiple_closures_with_trailing_closure)
func myFunc3(){myFunc1(
a1:1,
a2:{ _ in},
a3:"2"){ _ in}}
Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.
Removed some file paths to shorten the output lines
$ swiftlint
Linting Swift files in current working directory
Linting 'Closure.swift' (1/3)
Linting 'TrailingClosureApp.swift' (2/3)
Linting 'ContentView.swift' (3/3)
Closure.swift:27:7: warning: Multiple Closures with Trailing Closure Violation: Trailing closure syntax should not be used when passing more than one closure argument (multiple_closures_with_trailing_closure)
Closure.swift:15:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)
Done linting! Found 2 violations, 0 serious in 3 files.
Environment
SwiftLint version (run swiftlint version to be sure)
0.58.2
Xcode version (run xcodebuild -version to be sure)
Xcode 16.2, Build version 16C5032a
Installation method used (Homebrew, CocoaPods, building from source, etc)
brew install swiftlint
Configuration file:
opt_in_rules:
- trailing_closure
Are you using nested configurations? If so, paste their
relative paths and respective contents.
No
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Bug Description
Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.
Removed some file paths to shorten the output lines
Environment
swiftlint version
to be sure)xcodebuild -version
to be sure)Are you using nested configurations? If so, paste their
relative paths and respective contents.
No
The text was updated successfully, but these errors were encountered: