class StdoutResults
Print results to STDOUT
Public Instance Methods
message_violations(violations)
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 7 def message_violations(violations) violations.each do |violation| color = violation.type == 'FAIL' ? :red : :yellow message message_type: "#{violation.type} #{violation.id}", color: color, message: violation.message, logical_resource_ids: violation.logical_resource_ids, line_numbers: violation.line_numbers end end
print_failures(violations)
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 19 def print_failures(violations) puts "\nFailures count: #{Violation.count_failures(violations)}" end
print_warnings(violations)
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 23 def print_warnings(violations) puts "Warnings count: #{Violation.count_warnings(violations)}" end
render(results)
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 27 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
Private Instance Methods
indent_multiline_string_with_prefix(prefix, multiline_string)
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 47 def indent_multiline_string_with_prefix(prefix, multiline_string) "#{prefix} #{multiline_string.gsub(/\n/, "\n#{prefix} ")}" end
message()
click to toggle source
# File lib/cfn-nag/result_view/stdout_results.rb, line 43 def message raise 'Must be implemented in subclass!' end