class RuboCop::ConfigRegeneration
This class handles collecting the options for regenerating a TODO file. @api private
Constants
- AUTO_GENERATED_FILE
- COMMAND_REGEX
- DEFAULT_OPTIONS
Public Instance Methods
options()
click to toggle source
Get options from the comment in the TODO file, and parse them as options
# 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
Private Instance Methods
generation_command()
click to toggle source
# File lib/rubocop/config_regeneration.rb, line 29 def generation_command File.foreach(AUTO_GENERATED_FILE).take(2).last end
todo_exists?()
click to toggle source
# File lib/rubocop/config_regeneration.rb, line 25 def todo_exists? File.exist?(AUTO_GENERATED_FILE) && !File.empty?(AUTO_GENERATED_FILE) end