Class: SimpleStdoutResults

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn-nag/result_view/simple_stdout_results.rb

Overview

Print results to STDOUT

Instance Method Summary collapse

Instance Method Details

#message_violations(violations) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/cfn-nag/result_view/simple_stdout_results.rb', line 5

def message_violations(violations)
  violations.each do |violation|
    message message_type: "#{violation.type} #{violation.id}",
            message: violation.message,
            logical_resource_ids: violation.logical_resource_ids
  end
end


13
14
15
# File 'lib/cfn-nag/result_view/simple_stdout_results.rb', line 13

def print_failures(violations)
  puts "\nFailures count: #{Violation.count_failures(violations)}"
end


17
18
19
# File 'lib/cfn-nag/result_view/simple_stdout_results.rb', line 17

def print_warnings(violations)
  puts "Warnings count: #{Violation.count_warnings(violations)}"
end

#render(results) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cfn-nag/result_view/simple_stdout_results.rb', line 21

def render(results)
  results.each do |result|
    60.times { print '-' }
    puts "\n" + result[:filename]
    60.times { print '-' }

    violations = result[:file_results][:violations]

    message_violations violations
    print_failures violations
    print_warnings violations
  end
end