class RubocopChallenger::Rubocop::Command
To execute rubocop gem command (Mainly for mock when testing)
Public Instance Methods
auto_correct(only_safe_auto_correct:)
click to toggle source
Executes auto correction
# File lib/rubocop_challenger/rubocop/command.rb, line 10 def auto_correct(only_safe_auto_correct:) if only_safe_auto_correct run('--auto-correct') else run('--auto-correct-all') end end
auto_gen_config(exclude_limit: nil, auto_gen_timestamp: true)
click to toggle source
Generates `.rubocop_todo.yml`
@param exclude_limit [Integer] default: nil @param auto_gen_timestamp [Boolean] default: true
# File lib/rubocop_challenger/rubocop/command.rb, line 22 def auto_gen_config(exclude_limit: nil, auto_gen_timestamp: true) commands = ['--auto-gen-config'] commands << "--exclude-limit #{exclude_limit}" if exclude_limit commands << '--no-auto-gen-timestamp' unless auto_gen_timestamp run(*commands) end
Private Instance Methods
run(*subcommands)
click to toggle source
# File lib/rubocop_challenger/rubocop/command.rb, line 31 def run(*subcommands) command = "bundle exec rubocop #{subcommands.join(' ')} || true" execute(command) end