Class: SecurityReport::TableReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/security_report/table_reporter.rb

Instance Method Summary collapse

Instance Method Details

#report(results, skipped) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/security_report/table_reporter.rb', line 5

def report(results, skipped)
  if results.any?
    high, medium_or_lower = results.partition { |result| result.criticality == :high }
    medium, low_or_unknown = medium_or_lower.partition { |result| result.criticality == :medium }

    puts tableize("High criticality", high) if high.any?
    puts tableize("Medium criticality", medium) if medium.any?
    puts tableize("Low or unknown criticality", low_or_unknown) if low_or_unknown.any?
    puts
    puts "Vulnerabilities (#{high.size} high, #{medium.size} medium, #{low_or_unknown.size} low or unkown) found!"
  else
    puts "No vulnerabilities found"
  end

  if skipped.any?
    puts "Skipped #{skipped.join(", ")}: No Gemfile.lock found"
  end
end