Skip to content

Commit

Permalink
fix: false positive on sorted_first_last with firstIndex(of:) and las…
Browse files Browse the repository at this point in the history
…tIndex(of:) method

Fixes realm#2700
  • Loading branch information
r-plus committed Apr 1, 2019
1 parent 9d0ac2d commit c7a1cc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
[Dalton Claybrook](https://github.com/daltonclaybrook)
[#2683](https://github.com/realm/SwiftLint/issues/2683)

* Fix false positives on `sorted_first_last` when calling `firstIndex` and
`lastIndex` method.
[Taiki Komaba](https://github.com/r-plus)
[#2700](https://github.com/realm/SwiftLint/issues/2700)

## 0.31.0: Busy Laundromat

#### Breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public struct SortedFirstLastRule: CallPairRule, OptInRule, ConfigurationProvide

public func validate(file: File) -> [StyleViolation] {
return validate(file: file,
pattern: "[\\}\\)]\\s*\\.(first|last)",
pattern: "[\\}\\)]\\s*\\.(first|last)(?!Index)",
patternSyntaxKinds: [.identifier],
callNameSuffix: ".sorted",
severity: configuration.severity) { dictionary in
Expand Down

0 comments on commit c7a1cc1

Please sign in to comment.