Skip to content

False positive closure_spacing with only comment inside #4565

Closed

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 */ }

Activity

  1. added a commit that references this issue on Nov 25, 2022
  2. jpsim commented on Nov 25, 2022

    @jpsim
    Collaborator

    Fixed in #4584

  3. added
    bug
    on Nov 25, 2022
  4. added a commit that references this issue on Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions