Class: Attractor::ConsoleReporter::TableFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/attractor/reporters/console_reporter.rb

Instance Method Summary collapse

Instance Method Details

#call(calculators) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/attractor/reporters/console_reporter.rb', line 7

def call(calculators)
  puts "Calculated churn and complexity"
  puts
  puts "file_path#{" " * 53}complexity   churn"
  puts "-" * 80

  calculators.each do |calc|
    # e.g. ['js', JsCalculator']
    puts calc.last.type

    values = calc.last.calculate
    suggester = Suggester.new(values)

    puts values&.map(&:to_s)
    puts
    puts "Suggestions for refactorings:"
    suggester.suggest&.each { |sug| puts sug.file_path }
    puts
  end
end