lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.4 vs lib/fasterer/scanners/method_call_scanner.rb in fasterer-0.1.5
- old
+ new
@@ -41,10 +41,15 @@
check_merge_bang_offense
end
end
def check_module_eval_offense
- add_offense(:module_eval)
+ first_argument = method_call.arguments.first
+ return unless first_argument && first_argument.value.is_a?(String)
+
+ if first_argument.value.include?("def")
+ add_offense(:module_eval)
+ end
end
def check_gsub_offense
first_argument = method_call.arguments[0]
second_argument = method_call.arguments[1]