Class: RuboBot::RuboCop::AutoCorrect
- Inherits:
-
Object
- Object
- RuboBot::RuboCop::AutoCorrect
- Defined in:
- lib/rubobot/rubocop/auto_correct.rb
Overview
Run rubocop to auto-correct a cop
Defined Under Namespace
Classes: NotAutoCorrectableError
Instance Method Summary collapse
- #commit_message ⇒ Object
- #files_changed? ⇒ Boolean
-
#initialize(cop, paths) ⇒ AutoCorrect
constructor
A new instance of AutoCorrect.
- #run ⇒ Object
Constructor Details
#initialize(cop, paths) ⇒ AutoCorrect
Returns a new instance of AutoCorrect.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubobot/rubocop/auto_correct.rb', line 11 def initialize(cop, paths) @cop = cop @paths = paths formatter = 'RuboBot::RuboCop::Formatter::ClangStyleFormatter' = { safe_auto_correct: true, auto_correct: true, format: formatter, formatters: [[formatter]], only: [cop.name] } @runner = ::RuboCop::Runner.new(, ::RuboCop::ConfigStore.new) end |
Instance Method Details
#commit_message ⇒ Object
33 34 35 36 |
# File 'lib/rubobot/rubocop/auto_correct.rb', line 33 def raise NotAutoCorrectableError unless autocorrect? Git::CommitMessage.new(cop.name, command, stdout_str) end |
#files_changed? ⇒ Boolean
29 30 31 |
# File 'lib/rubobot/rubocop/auto_correct.rb', line 29 def files_changed? status end |
#run ⇒ Object
25 26 27 |
# File 'lib/rubobot/rubocop/auto_correct.rb', line 25 def run files_changed? end |