Skip to content

Commit

Permalink
Merge pull request #337 from ekohl/fix-reflect-warning
Browse files Browse the repository at this point in the history
[Fix #336] Expand the safety warning on Performance/Detect
  • Loading branch information
koic authored Jan 26, 2023
2 parents a28bd39 + 83b47e3 commit 3cdb861
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rubocop/cop/performance/detect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ module Performance
# `detect` instead.
#
# @safety
# This cop is unsafe because is has known compatibility issues with `ActiveRecord` and other
# frameworks. `ActiveRecord` does not implement a `detect` method and `find` has its own
# meaning. Correcting `ActiveRecord` methods with this cop should be considered unsafe.
# This cop is unsafe because is assumes the class implements the
# `Enumerable` interface, but can't reliably detect this. This creates
# known compatibility issues with `Hash`, `ActiveRecord` and other
# frameworks. `Hash` and `ActiveRecord` do not implement a `detect`
# method and `find` has its own meaning. Correcting `Hash` and
# `ActiveRecord` methods with this cop should be considered unsafe.
#
# @example
# # bad
Expand Down

0 comments on commit 3cdb861

Please sign in to comment.