Closed
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
A clear and concise description of what the bug is.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
/Users/liam/Documents/Example/AppDelegate.swift:26:45: Array Init Violation: Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array. (array_init)
Environment
- SwiftLint version (run
swiftlint version
to be sure)? 0.45.0 - Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
- Paste your configuration file:
only_rules:
- array_init
-
Are you using nested configurations?
If so, paste their relative paths and respective contents.
No -
Which Xcode version are you using (check
xcodebuild -version
)?
Xcode 13.1 -
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 useswiftlint lint --path [file here] --no-cache --enable-all-rules
.
enum BizError: Swift.Error {
}
let reqResult: Result<String, BizError> = .success("")
// False positive in `array_init`
let result: Result<Any, BizError> = reqResult.map { $0 }
print(result)