-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 #1979
Comments
What customer service – thanks JP!
…On Dec 21, 2017, 3:17 PM -0500, JP Simard ***@***.***>, wrote:
New Issue Checklist
• Updated SwiftLint to the latest version
• I searched for existing GitHub issues
Bug Report
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint --path test.swift
Linting Swift files at path test.swift
Linting 'test.swift' (1/1)
/Users/jsimard/Downloads/test.swift:3:5: warning: Unused Closure Parameter Violation: Unused parameter "manager" 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.24.0
• Installation method used (Homebrew, CocoaPods, building from source, etc)?
Homebrew
• Paste your configuration file:
None.
• Are you using nested configurations?
If so, paste their relative paths and respective contents.
None.
• Which Xcode version are you using (check xcode-select -p)?
/Applications/Xcode-9.2.app/Contents/Developer
• 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.
import Foundation
({ (manager: FileManager) in
print(manager)
})(FileManager.default)
Also, as reported by @irace:
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So SourceKit is returning some BS with closures of this format. Here's what it thinks the name of the closure is: Looking into making a workaround. |
This would be way easier/more reliable if we SourceKit returned closures in the structure (https://bugs.swift.org/browse/SR-6116). I started implementing it a few months ago, but it looks like I lost my WIP branch ¯_(ツ)_/¯ |
when closure is wrapped in parentheses. Fixes #1979. Definitely not elegant, but it should help.
New Issue Checklist
Bug Report
Complete output when running SwiftLint, including the stack trace and command used
Environment
swiftlint version
to be sure)?0.24.0
Homebrew
None.
If so, paste their relative paths and respective contents.
None.
xcode-select -p
)?/Applications/Xcode-9.2.app/Contents/Developer
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
.Also, as reported by @irace:
The text was updated successfully, but these errors were encountered: