SwiftLint
SwiftLint copied to clipboard
`vertical_parameter_alignment_on_call` doesn't recognize multiple trailing closures
New Issue Checklist
- [x] Updated SwiftLint to the latest version
- [x] I searched for existing GitHub issues
Describe the bug
vertical_parameter_alignment_on_call fails when a method call:
- lists its parameters vertically
- has multiple trailing closures
- has the closing parenthesis and the first opening brace
) {on a new line
Complete output when running SwiftLint, including the stack trace and command used
$ ./Pods/SwiftLint/swiftlint
Linting Swift files in current working directory
Linting 'TestArea.swift' (1/1)
/Users/commscheck/src/commscheck/SwiftLintTrailingClosures/Shared/TestArea.swift:11:11: warning: Vertical Parameter Alignment On Call Violation: Function parameters should be aligned vertically if they're in multiple lines in a method call. (vertical_parameter_alignment_on_call)
Done linting! Found 1 violation, 0 serious in 1 file.
Environment
- SwiftLint version (run
swiftlint versionto be sure)? 0.43.1 - Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
- Paste your configuration file:
opt_in_rules:
- vertical_parameter_alignment_on_call
- Are you using nested configurations? No
- Which Xcode version are you using (check
xcodebuild -version)? 12.4.0 - Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesto quickly test if your example is really demonstrating the issue. If your example is more complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules.
// Passes as expected
UIViewPropertyAnimator.runningPropertyAnimator(
withDuration: 2.0,
delay: 0.0,
options: [.curveEaseIn]
) {
// animations
}
// Passes as expected
UIViewPropertyAnimator.runningPropertyAnimator(
withDuration: 2.0,
delay: 0.0,
options: [.curveEaseIn]) {
// animations
} completion: { _ in
// completion
}
// Triggers a violation
UIViewPropertyAnimator.runningPropertyAnimator(
withDuration: 2.0,
delay: 0.0,
options: [.curveEaseIn]
) {
// animations
} completion: { _ in
// completion
}
What about this issue? This is a problem!
Related to #3399.
Any updates?
We have no choice but to disable vertical_parameter_alignment_on_call. 😔
You can try to use it like this.
UIViewPropertyAnimator.runningPropertyAnimator(
withDuration: 2.0,
delay: 0.0,
options: [.curveEaseIn]
animations: {
// animations
},
completion: { _ in
// completion
})