Class: RuboCop::Gradual::Process::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/gradual/process/printer.rb

Overview

Printer class prints the results of the RuboCop Gradual process.

Instance Method Summary collapse

Constructor Details

#initialize(diff) ⇒ Printer

Returns a new instance of Printer.



8
9
10
# File 'lib/rubocop/gradual/process/printer.rb', line 8

def initialize(diff)
  @diff = diff
end

Instance Method Details



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rubocop/gradual/process/printer.rb', line 18

def print_ci_warning(diff, statistics:)
  puts <<~MSG
    \n#{bold("Unexpected Changes!")}

    RuboCop Gradual lock file is outdated, to fix this message:
    - Run `rubocop-gradual` locally and commit the results#{
      if statistics[:unchanged] != statistics[:left]
        ", or\n- EVEN BETTER: before doing the above, try to fix the remaining issues in those files!"
      end
    }

    #{bold("`#{Configuration.path}` diff:")}

    #{diff.to_s(ARGV.include?("--no-color") ? :text : :color)}
  MSG
end


12
13
14
15
16
# File 'lib/rubocop/gradual/process/printer.rb', line 12

def print_results
  puts diff.statistics if Configuration.debug?

  send :"print_#{diff.state}"
end