Class: Yarn::Audit::Wrap::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/yarn/audit/wrap/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts:) ⇒ Config

Returns a new instance of Config.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/yarn/audit/wrap/config.rb', line 5

def initialize(opts:)
  # format of config file:
  # hash with ignore: key, an array of hashes.  Each hash can have one or more
  # keys where the value is matched.
  # One additional key is `until: <date>` where the ignore item is resurfaced,
  # to avoid eternal vulnerabilities.
  # YAML.dump({ ignore: [ { "github_adivosry_id" => "GHSA-cj88-88mr-972w" } ] })
  audit_config = opts[:audit_config]
  @config = if File.exist?(audit_config)
    YAML.safe_load(File.read(audit_config), permitted_classes: [Symbol, Date])
  else
    {}
  end
end

Instance Method Details

#ignoresObject



20
21
22
23
24
25
26
# File 'lib/yarn/audit/wrap/config.rb', line 20

def ignores
  if @config && @config.size > 0
    @config[:ignore]
  else
    []
  end
end