New Issue Checklist
Describe the bug
The rule should not trigger when the enumerated index and element are used in separate subsequent blocks
Environment
- SwiftLint version (run
swiftlint version to be sure)? 0.55.1
- Installation method used (Homebrew, CocoaPods, building from source, etc)? Cocoapods
- Paste your configuration file:
# insert yaml contents here
- Are you using nested configurations? No
If so, paste their relative paths and respective contents.
- Which Xcode version are you using (check
xcodebuild -version)? 15.3
- 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.
protocol Rule {
func isValid() -> Bool
}
let rules: [Rule] = [rule1, rule2]
let messages = ["msg1", "msg2"]
// This triggers a violation:
rules.enumerated()
.first { $0.element.isValid() == false }
.flatMap { messages[$0.offset] }
New Issue Checklist
Describe the bug
The rule should not trigger when the enumerated index and element are used in separate subsequent blocks
Environment
swiftlint versionto be sure)? 0.55.1# insert yaml contents hereIf so, paste their relative paths and respective contents.
xcodebuild -version)? 15.3echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesto 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.