Class: Necropsy::Bench::ReleaseAudit::ConfigValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/necropsy/bench/release_audit/config_validator.rb

Constant Summary collapse

REQUIRED_CORPORA =
%w[dynamic_evidence plain_ruby rails rubocop_1_75_0 self].freeze
REQUIRED_ADVERSARIAL_SUITES =
%w[ambiguity dynamic parse remote_input].freeze
REQUIRED_REVIEW_POLICIES =
%w[rails rubocop_1_75_0].freeze

Instance Method Summary collapse

Constructor Details

#initialize(config, strict_release: true) ⇒ ConfigValidator

Returns a new instance of ConfigValidator.



13
14
15
16
# File 'lib/necropsy/bench/release_audit/config_validator.rb', line 13

def initialize(config, strict_release: true)
  @config = config
  @strict_release = strict_release
end

Instance Method Details

#validate!Object

Raises:



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/necropsy/bench/release_audit/config_validator.rb', line 18

def validate!
  raise Error, 'Release audit config must be a mapping' unless config.is_a?(Hash)
  raise Error, 'Release audit schema_version must be 1' unless config['schema_version'] == 1

  validate_nonempty_unique('corpora', config['corpora'])
  validate_suites
  validate_review_policies
  validate_precision_gate
  validate_strict_release if strict_release
  config
end