Class: RubocopChallenger::Rubocop::Command
- Inherits:
-
Object
- Object
- RubocopChallenger::Rubocop::Command
- Includes:
- PrComet::CommandLine
- Defined in:
- lib/rubocop_challenger/rubocop/command.rb
Overview
To execute rubocop gem command (Mainly for mock when testing)
Instance Method Summary collapse
-
#auto_gen_config(exclude_limit: nil, auto_gen_timestamp: true, offense_counts: true, only_exclude: false) ⇒ Object
Generates ‘.rubocop_todo.yml`.
-
#autocorrect(only_safe_autocorrect:) ⇒ Object
Executes auto correction.
Instance Method Details
#auto_gen_config(exclude_limit: nil, auto_gen_timestamp: true, offense_counts: true, only_exclude: false) ⇒ Object
Generates ‘.rubocop_todo.yml`
24 25 26 27 28 29 30 31 |
# File 'lib/rubocop_challenger/rubocop/command.rb', line 24 def auto_gen_config(exclude_limit: nil, auto_gen_timestamp: true, offense_counts: true, only_exclude: false) commands = ['--auto-gen-config'] commands << "--exclude-limit #{exclude_limit}" if exclude_limit commands << '--no-auto-gen-timestamp' unless commands << '--no-offense-counts' unless offense_counts commands << '--auto-gen-only-exclude' if only_exclude run(*commands) end |
#autocorrect(only_safe_autocorrect:) ⇒ Object
Executes auto correction
10 11 12 13 14 15 16 |
# File 'lib/rubocop_challenger/rubocop/command.rb', line 10 def autocorrect(only_safe_autocorrect:) if only_safe_autocorrect run('-a') # --autocorrect Autocorrect offenses (only when it's safe). else run('-A') # --autocorrect-all Autocorrect offenses (safe and unsafe). end end |