Method: RuboCop::Cop::Lint::DuplicateMagicComment#on_new_investigation

Defined in:
lib/rubocop/cop/lint/duplicate_magic_comment.rb

#on_new_investigationObject


35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rubocop/cop/lint/duplicate_magic_comment.rb', line 35

def on_new_investigation
  return if processed_source.buffer.source.empty?

  magic_comment_lines.each_value do |comment_lines|
    next if comment_lines.count <= 1

    comment_lines[1..].each do |comment_line|
      range = processed_source.buffer.line_range(comment_line + 1)

      register_offense(range)
    end
  end
end