Method: RuboCop::Cop::Bundler::OrderedGems#on_new_investigation

Defined in:
lib/rubocop/cop/bundler/ordered_gems.rb

#on_new_investigationObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rubocop/cop/bundler/ordered_gems.rb', line 43

def on_new_investigation
  return if processed_source.blank?

  gem_declarations(processed_source.ast)
    .each_cons(2) do |previous, current|
    next unless consecutive_lines?(previous, current)
    next unless case_insensitive_out_of_order?(gem_name(current), gem_name(previous))

    register_offense(previous, current)
  end
end