lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.6 vs lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.7

- old
+ new

@@ -37,10 +37,12 @@ check_flatten_offense when :fetch check_fetch_offense when :merge! check_merge_bang_offense + when :last + check_last_offense end end def check_module_eval_offense first_argument = method_call.arguments.first @@ -137,9 +139,18 @@ first_argument = method_call.arguments.first return unless first_argument.type == :hash if first_argument.element.drop(1).count == 2 # each key and value is an item by itself. add_offense(:hash_merge_bang_vs_hash_brackets) + end + end + + def check_last_offense + return method_call unless method_call.receiver.is_a?(MethodCall) + + case method_call.receiver.name + when :select + add_offense(:select_last_vs_reverse_detect) end end end end