Class: Fastlane::Checks::ReportParser

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/checks/helper/report_parser.rb

Constant Summary collapse

OPPORTUNITY =
"OPPORTUNITY"
POTENTIAL =
"POTENTIAL"
PRIORITY =
"PRIORITY"

Instance Method Summary collapse

Constructor Details

#initialize(severity_threshold) ⇒ ReportParser

Returns a new instance of ReportParser.



24
25
26
# File 'lib/fastlane/plugin/checks/helper/report_parser.rb', line 24

def initialize(severity_threshold)
  @severity_threshold = severity_threshold
end

Instance Method Details

#is_severity_included_in_threshold(severity) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/fastlane/plugin/checks/helper/report_parser.rb', line 28

def is_severity_included_in_threshold(severity)
  case @severity_threshold
  when OPPORTUNITY
    return severity == PRIORITY || severity == POTENTIAL || severity == OPPORTUNITY
  when POTENTIAL
    return severity == PRIORITY || severity == POTENTIAL
  when PRIORITY
    return severity == PRIORITY
  end
end

#parse(report) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/fastlane/plugin/checks/helper/report_parser.rb', line 39

def parse(report)
  failing_checks = []
  report["checks"].each do |check|
    if check['state'] == "FAILED" && is_severity_included_in_threshold(check['severity'])
      failing_checks << check
    end
  end
  return failing_checks
end