lib/rubocop/cop/performance/detect.rb in rubocop-performance-1.4.1 vs lib/rubocop/cop/performance/detect.rb in rubocop-performance-1.5.0
- old
+ new
@@ -21,12 +21,10 @@
# `ActiveRecord` compatibility:
# `ActiveRecord` does not implement a `detect` method and `find` has its
# own meaning. Correcting ActiveRecord methods with this cop should be
# considered unsafe.
class Detect < Cop
- include SafeMode
-
MSG = 'Use `%<prefer>s` instead of ' \
'`%<first_method>s.%<second_method>s`.'
REVERSE_MSG = 'Use `reverse.%<prefer>s` instead of ' \
'`%<first_method>s.%<second_method>s`.'
@@ -36,11 +34,9 @@
(send $(send _ {:select :find_all} ...) ${:first :last} $...)
}
PATTERN
def on_send(node)
- return if rails_safe_mode?
-
detect_candidate?(node) do |receiver, second_method, args|
return unless args.empty?
return unless receiver
receiver, _args, body = *receiver if receiver.block_type?