module Bundler::Audit::CLI::Formats::Junit

Public Instance Methods

print_report(report, output=$stdout) click to toggle source

Prints any findings as an XML junit report.

@param [Report] report

The results from the {Scanner}.

@param [IO, File] output

Optional output stream.

Private Instance Methods

advisory_criticality(advisory) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 110
def advisory_criticality(advisory)
  if advisory.criticality
    advisory.criticality.to_s.capitalize
  else
    "Unknown"
  end
end
advisory_ref(advisory) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 118
def advisory_ref(advisory)
  advisory.identifiers.join(" ")
end
advisory_solution(advisory) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 102
def advisory_solution(advisory)
  unless advisory.patched_versions.empty?
    "update to #{advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')}"
  else
    "remove or disable this gem until a patch is available!"
  end
end
bundle_title(result) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 98
def bundle_title(result)
  "#{advisory_criticality(result.advisory).upcase} #{result.gem.name}(#{result.gem.version}) #{result.advisory.title}"
end
print_xml_testcase(result) click to toggle source
print_xml_testsuite(report) { || ... } click to toggle source
say_xml(*lines) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 50
def say_xml(*lines)
  say(lines.join($/))
end
xml(string) click to toggle source
# File lib/bundler/audit/cli/formats/junit.rb, line 69
def xml(string)
  CGI.escapeHTML(string.to_s)
end