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 on sorted_first_last with Realm #2533

Closed
marcelofabri opened this Issue Dec 26, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@marcelofabri
Copy link
Collaborator

marcelofabri commented Dec 26, 2018

New Issue Checklist

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
$ echo "results.sorted(byKeyPath: #keyPath(Message.timestamp), ascending: false).first" | swiftlint lint --no-cache --use-stdin --enable-all-rules
Loading configuration from '.swiftlint.yml'
<nopath>:1:1: warning: Min or Max over Sorted First or Last Violation: Prefer using `min()` or `max()` over `sorted().first` or `sorted().last` (sorted_first_last)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.29.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Paste your configuration file:
opt_in_rules:
  - sorted_first_last

No

  • Which Xcode version are you using (check xcode-select -p)?

10.2

  • 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.
// This triggers a violation:
results.sorted(byKeyPath: #keyPath(Message.timestamp), ascending: false).first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment