Class: Bundle::Patch::Audit::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle/patch/audit/parser.rb

Class Method Summary collapse

Class Method Details

.runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bundle/patch/audit/parser.rb', line 9

def self.run
  puts "🔍 Running `bundle-audit check --format json`..."

  output, _status = Open3.capture2("bundle-audit check --format json")

  # Even if status is non-zero, it's likely due to found vulnerabilities
  begin
    parsed = JSON.parse(output)
    # parsed["results"] || []
    parsed["results"].map { |data| Advisory.new(data) }
  rescue JSON::ParserError => e
    abort "❌ Could not parse bundle-audit output: #{e.message}"
  end
end