Class: RuboCop::ConfigRegeneration Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rubocop/config_regeneration.rb |
Overview
This class handles collecting the options for regenerating a TODO file.
Constant Summary
-
AUTO_GENERATED_FILE =
# File 'lib/rubocop/config_regeneration.rb', line 7RuboCop::CLI::Command::AutoGenerateConfig::AUTO_GENERATED_FILE
-
COMMAND_REGEX =
# File 'lib/rubocop/config_regeneration.rb', line 8/(?<=`rubocop )(.*?)(?=`)/.freeze
-
DEFAULT_OPTIONS =
# File 'lib/rubocop/config_regeneration.rb', line 9{ auto_gen_config: true }.freeze
Instance Attribute Summary
- #todo_exists? ⇒ Boolean readonly private Internal use only
Instance Method Summary
-
#options
Internal use only
Get options from the comment in the TODO file, and parse them as options.
- #generation_command private Internal use only
Instance Attribute Details
#todo_exists? ⇒ Boolean
(readonly, private)
# File 'lib/rubocop/config_regeneration.rb', line 25
def todo_exists? File.exist?(AUTO_GENERATED_FILE) && !File.empty?(AUTO_GENERATED_FILE) end
Instance Method Details
#generation_command (private)
[ GitHub ]# File 'lib/rubocop/config_regeneration.rb', line 29
def generation_command File.foreach(AUTO_GENERATED_FILE).take(2).last end
#options
Get options from the comment in the TODO file, and parse them as options
# File 'lib/rubocop/config_regeneration.rb', line 12
def # 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 = match[1].split Options.new.parse( ).first end