Module: Inspec::EnhancedOutcomes

Defined in:
lib/inspec/enhanced_outcomes.rb

Class Method Summary collapse

Class Method Details

.determine_status(results, impact) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/inspec/enhanced_outcomes.rb', line 4

def self.determine_status(results, impact)
  # No-op exception occurs in case of not_applicable_if
  if results.any? { |r| !r[:exception].nil? && !r[:backtrace].nil? && r[:resource_class] != "noop" }
    "error"
  elsif !impact.nil? && impact.to_f == 0.0
    "not_applicable"
  elsif results.all? { |r| r[:status] == "skipped" }
    "not_reviewed"
  elsif results.any? { |r| r[:status] == "failed" }
    "failed"
  else
    "passed"
  end
end