SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

`vertical_parameter_alignment_on_call` doesn't recognize multiple trailing closures

Open commscheck opened this issue 4 years ago • 2 comments

New Issue Checklist

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 version to 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-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.
// 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
}

commscheck avatar Mar 24 '21 01:03 commscheck

What about this issue? This is a problem!

Fab1n avatar Oct 12 '22 12:10 Fab1n

Related to #3399.

SimplyDanny avatar Dec 03 '22 17:12 SimplyDanny

Any updates? We have no choice but to disable vertical_parameter_alignment_on_call. 😔

417-72KI avatar Mar 08 '23 01:03 417-72KI

You can try to use it like this.

UIViewPropertyAnimator.runningPropertyAnimator(
    withDuration: 2.0,
    delay: 0.0,
    options: [.curveEaseIn]
    animations:  {
        // animations
    }, 
    completion: { _ in
        // completion
    })

yildirimatcioglu avatar May 02 '23 11:05 yildirimatcioglu