Class: RuboCop::Gradual::Process
- Inherits:
-
Object
- Object
- RuboCop::Gradual::Process
- Defined in:
- lib/rubocop/gradual/process.rb,
lib/rubocop/gradual/process/diff.rb,
lib/rubocop/gradual/process/matcher.rb,
lib/rubocop/gradual/process/printer.rb,
lib/rubocop/gradual/process/calculate_diff.rb
Overview
Process is a class that handles the processing of RuboCop results.
Defined Under Namespace
Modules: CalculateDiff Classes: Diff, Matcher, Printer
Instance Attribute Summary collapse
-
#lock_file ⇒ Object
readonly
Returns the value of attribute lock_file.
-
#new_results ⇒ Object
readonly
Returns the value of attribute new_results.
-
#old_results ⇒ Object
readonly
Returns the value of attribute old_results.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(rubocop_result) ⇒ Process
constructor
A new instance of Process.
Constructor Details
#initialize(rubocop_result) ⇒ Process
Returns a new instance of Process.
14 15 16 17 18 19 |
# File 'lib/rubocop/gradual/process.rb', line 14 def initialize(rubocop_result) @lock_file = LockFile.new(Configuration.path) @old_results = lock_file.read_results @new_results = Results.new(files: rubocop_result) add_skipped_files_to_new_results! end |
Instance Attribute Details
#lock_file ⇒ Object (readonly)
Returns the value of attribute lock_file.
12 13 14 |
# File 'lib/rubocop/gradual/process.rb', line 12 def lock_file @lock_file end |
#new_results ⇒ Object (readonly)
Returns the value of attribute new_results.
12 13 14 |
# File 'lib/rubocop/gradual/process.rb', line 12 def new_results @new_results end |
#old_results ⇒ Object (readonly)
Returns the value of attribute old_results.
12 13 14 |
# File 'lib/rubocop/gradual/process.rb', line 12 def old_results @old_results end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rubocop/gradual/process.rb', line 21 def call diff = CalculateDiff.call(new_results, old_results) printer = Printer.new(diff) printer.print_results if fail_with_outdated_lock?(diff) printer.print_ci_warning(lock_file.diff(new_results), statistics: diff.statistics) end exit_code = error_code(diff) sync_lock_file(diff) if exit_code.zero? exit_code end |