Skip to content

False positive closure_spacing with only comment inside #4565

@Igor-Palaguta

Description

@Igor-Palaguta

New Issue Checklist

Describe the bug

closure_spacing is fired when closure contains only comment

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

warning: Closure Spacing Violation: Closure expressions should have a single space inside each brace. (closure_spacing)

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.50.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Cocoapods
  • Paste your configuration file:
opt_in_rules:
  - closure_spacing
  • Are you using nested configurations?
    no
  • Which Xcode version are you using (check xcodebuild -version)?
    Xcode 14.0
    Build version 14A309
  • Do you have a sample that shows the issue? Run echo "let test1 = func1(arg: { /* do nothing */ })" | 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.
// This triggers a violation:
let test1 = func1(arg: { /* do nothing */ })
let test2 = func1 { /* do nothing */ }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected and reproducible misbehavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions