-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
force_unwrapping
is not fired for trailing closures syntax
let value = [1, 3, 5, 6].first { $0.isMultiple(of: 2) }!
Same case but with parentheses around works fine
let value = [1, 3, 5, 6].first({ $0.isMultiple(of: 2) })!
Complete output when running SwiftLint, including the stack trace and command used
E.g. for this case superfluous_disable_command
rule is fired
let value = [1, 3, 5, 6].first { $0.isMultiple(of: 2) }! // swiftlint:disable:this force_unwrapping
$ swiftlint lint
Superfluous Disable Command Violation: SwiftLint rule 'force_unwrapping' did not trigger a violation in the disabled region. Please remove the disable command. (superfluous_disable_command)
Environment
- SwiftLint version (run
swiftlint version
to be sure)?
0.35.0 - Installation method used (Homebrew, CocoaPods, building from source, etc)?
CocoaPods - Paste your configuration file:
opt_in_rules:
- force_unwrapping
- Are you using nested configurations?
no - Which Xcode version are you using (check
xcode-select -p
)?
Version 11.1 (11A1027) - Do you have a sample that shows the issue? Run
echo "let value = [1, 3, 5, 6].first { $0.isMultiple(of: 2) }!" | 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 useswiftlint lint --path [file here] --no-cache --enable-all-rules
.
// This triggers a violation:
let value = [1, 3, 5, 6].first { $0.isMultiple(of: 2) }!
cndouglas
Metadata
Metadata
Assignees
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.