lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.0 vs lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.1
- old
+ new
@@ -45,10 +45,13 @@
def check_module_eval_offense
add_offense(:module_eval)
end
def check_gsub_offense
- unless method_call.arguments.first.value.is_a? Regexp
+ first_argument = method_call.arguments.first
+ return if first_argument.nil?
+
+ if first_argument.value.is_a?(String) && first_argument.value.size == 1
add_offense(:gsub_vs_tr)
end
end
def check_sort_offense