Skip to content

vertical_parameter_alignment_on_call doesn't recognize multiple trailing closures #3581

Description

@commscheck

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected and reproducible misbehavior.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions