class RuboCop::Cop::Generator::ConfigurationInjector

namespace and injects the provided one in alpha
It looks for other directives that require files in the same (cop)
A class that injects a require directive into the root RuboCop file.

def configuration_entries

def configuration_entries
  @configuration_entries ||= File.readlines(configuration_file_path)
end

def cop_name_line?(yaml)

def cop_name_line?(yaml)
  !/^[\s#]/.match?(yaml)
end

def find_target_line

def find_target_line
  configuration_entries.find.with_index do |line, index|
    next unless cop_name_line?(line)
    return index if badge.to_s < line
  end
  nil
end

def initialize(configuration_file_path:, badge:, version_added: '<<next>>')

def initialize(configuration_file_path:, badge:, version_added: '<<next>>')
  @configuration_file_path = configuration_file_path
  @badge = badge
  @version_added = version_added
  @output = output
end

def inject

def inject
  target_line = find_target_line
  if target_line
    configuration_entries.insert(target_line, "#{new_configuration_entry}\n")
  else
    configuration_entries.push("\n#{new_configuration_entry}")
  end
  File.write(configuration_file_path, configuration_entries.join)
  yield if block_given?
end

def new_configuration_entry

def new_configuration_entry
  format(TEMPLATE, badge: badge, version_added: version_added)
end