lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.2 vs lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.3
- old
+ new
@@ -45,13 +45,17 @@
def check_module_eval_offense
add_offense(:module_eval)
end
def check_gsub_offense
- first_argument = method_call.arguments.first
- return if first_argument.nil?
+ first_argument = method_call.arguments[0]
+ second_argument = method_call.arguments[1]
- if first_argument.value.is_a?(String) && first_argument.value.size == 1
+ return if first_argument.nil? || second_argument.nil?
+
+ if first_argument.value.is_a?(String) && first_argument.value.size == 1 &&
+ second_argument.value.is_a?(String) && second_argument.value.size == 1
+
add_offense(:gsub_vs_tr)
end
end
def check_sort_offense