47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/rubocop/cop/lint/redundant_require_statement.rb', line 47
def on_send(node)
return unless redundant_require_statement?(node)
add_offense(node) do |corrector|
if node.parent.respond_to?(:modifier_form?) && node.parent.modifier_form?
corrector.insert_after(node.parent, "\nend")
range = range_with_surrounding_space(node.source_range, side: :right)
else
range = range_by_whole_lines(node.source_range, include_final_newline: true)
end
corrector.remove(range)
end
end
|