Sha256: 1eccd90c46e020d87ba11cd8cd682419b055d8f0284403a60f1fbfddf84da5b7
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module RepoAnalyzer class BundlerAuditExtractor < ProjectInfoExtractor KEY_VALUE_REGEXP = /\A(.*):\s(.*)\z/ private def extracted_info { vulnerabilities: audit_info } end def audit_info audit_collection.inject({}) do |memo, row| category = nil formatted_item = row.split("\n").inject({}) do |item, line| key, value = extract_key_value_form_row(line) if key == :criticality category = value memo[category] ||= [] next item end item[key] = value item end memo[category] << formatted_item memo end end def audit_collection collection = audit_raw_result.split("\n\n") collection.pop collection end def extract_key_value_form_row(line) key, value = line.scan(KEY_VALUE_REGEXP).flatten key = key.gsub(" ", "_").downcase.to_sym [key, value] end def audit_raw_result `bundle exec bundle-audit update` `bundle exec bundle-audit check #{project_data_bridge.project_path}` end end end
Version data entries
3 entries across 3 versions & 1 rubygems