Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive in unused_closure_parameter when using backticks #3628

Closed
2 tasks done
sberrevoets opened this issue May 5, 2021 · 2 comments · Fixed by #3916
Closed
2 tasks done

False positive in unused_closure_parameter when using backticks #3628

sberrevoets opened this issue May 5, 2021 · 2 comments · Fixed by #3916
Labels
bug Unexpected and reproducible misbehavior.

Comments

@sberrevoets
Copy link

sberrevoets commented May 5, 2021

New Issue Checklist

Describe the bug

SwiftLint reports a false positive for unused_closure_parameter when the parameter in question is wrapped in backticks. #2006 is a similar issue (and potentially a manifestation of the same bug) but was closed.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint --path Sample.swift --no-cache --enable-all-rules
Linting Swift files at paths Sample.swift
Linting 'Sample.swift' (1/1)
/Users/scott/Developer/Sample.swift:4:31: warning: Unused Closure Parameter Violation: Unused parameter "class" in a closure should be replaced with _. (unused_closure_parameter)
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)? Homebrew
  • Paste your configuration file: none
  • Are you using nested configurations? No
  • Which Xcode version are you using (check xcodebuild -version)? Xcode 12.4 12D4e
  • Do you have a sample that shows the issue?

Sample.swift

internal struct Sample {
    internal func test() -> [String] {
        let classes: [String] = ["a", "b", "c"]
        return array.filter { `class` in `class`.hasPrefix("a") }
    }
}
@lhunath
Copy link

lhunath commented Mar 23, 2022

maybe we could add the bug label?

@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Mar 23, 2022
@jpsim
Copy link
Collaborator

jpsim commented Mar 23, 2022

Fix: #3916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants