module Bundler::Audit::CLI::Formats::JSON
The JSON
output format.
Public Instance Methods
criticality_label(advisory)
click to toggle source
# File lib/bundler/audit/cli/formats/json.rb, line 49 def criticality_label(advisory) case advisory.criticality when :none then "none" when :low then "low" when :medium then "medium" when :high then "high" when :critical then "critical" else "unknown" end end
print_report(report,output=$stdout)
click to toggle source
Outputs the report as JSON
. Will pretty-print JSON
if ‘output` is a TTY, otherwise normal JSON
will be outputted.
@param [Report] report
The results from the {Scanner}.
@param [IO, File] output
The output stream.
# File lib/bundler/audit/cli/formats/json.rb, line 39 def print_report(report,output=$stdout) hash = report.to_h if output.tty? output.puts(::JSON.pretty_generate(hash)) else output.write(::JSON.generate(hash)) end end