Class: RuboCop::ConfigRegeneration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/config_regeneration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class handles collecting the options for regenerating a TODO file.

Constant Summary collapse

AUTO_GENERATED_FILE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

RuboCop::CLI::Command::AutoGenerateConfig::AUTO_GENERATED_FILE
COMMAND_REGEX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/(?<=`rubocop )(.*?)(?=`)/.freeze
DEFAULT_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{ auto_gen_config: true }.freeze

Instance Method Summary collapse

Instance Method Details

#optionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get options from the comment in the TODO file, and parse them as options



12
13
14
15
16
17
18
19
20
21
# File 'lib/rubocop/config_regeneration.rb', line 12

def options
  # If there's no existing TODO file, generate one
  return DEFAULT_OPTIONS unless todo_exists?

  match = generation_command.match(COMMAND_REGEX)
  return DEFAULT_OPTIONS unless match

  options = match[1].split
  Options.new.parse(options).first
end