Class: RulesView

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

Instance Method Summary collapse

Instance Method Details

#emit(rule_registry, profile) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cfn-nag/result_view/rules_view.rb', line 3

def emit(rule_registry, profile)

  puts 'WARNING VIOLATIONS:'
  rule_registry.warnings.sort {|left, right| sort_id(left, right) }.each do |warning|
    if profile.nil?
      puts "#{warning.id} #{warning.message}"
    else
      puts "#{warning.id} #{warning.message}" if profile.execute_rule?(warning.id)
    end
  end
  puts
  puts 'FAILING VIOLATIONS:'
  rule_registry.failings.sort {|left, right| sort_id(left, right) }.each do |failing|
    if profile.nil?
      puts "#{failing.id} #{failing.message}"
    else
      puts "#{failing.id} #{failing.message}" if profile.execute_rule?(failing.id)
    end
  end
end