Class: Stellwerk::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/stellwerk/printer.rb

Instance Method Summary collapse

Constructor Details

#initialize(violations) ⇒ Printer



3
4
5
# File 'lib/stellwerk/printer.rb', line 3

def initialize(violations)
  @violations = violations
end

Instance Method Details



7
8
9
10
11
12
13
14
15
16
# File 'lib/stellwerk/printer.rb', line 7

def print
  puts "\nFound #{@violations.length} violations."

  @violations.group_by { |violation| violation.rule }.each do |rule, violations|
    puts "#{rule.name.titleize} rule violations:"
    violations.each do |violation|
      puts "  " + format_reference(violation.reference)
    end
  end
end