Module: Bundler::Audit::CLI::Formats::Text

Defined in:
lib/bundler/audit/cli/formats/text.rb

Overview

The plain-text output format.

Instance Method Summary collapse

Instance Method Details

Prints any findings as plain-text.

Parameters:

  • report (Report)

    The results from the Scanner.

  • output (IO, File) (defaults to: $stdout)

    Optional output stream.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bundler/audit/cli/formats/text.rb', line 37

def print_report(report,output=$stdout)
  original_stdout = $stdout
  $stdout = output

  report.each do |result|
    case result
    when Results::InsecureSource
      print_warning "Insecure Source URI found: #{result.source}"
    when Results::UnpatchedGem
      print_advisory result.gem, result.advisory
    end
  end

  if report.vulnerable?
    say "Vulnerabilities found!", :red
  else
    say("No vulnerabilities found", :green) unless options.quiet?
  end

  $stdout = original_stdout
end