Class: Necropsy::Bench::CandidateUnion

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

Constant Summary collapse

LABELS =
%w[dead alive external unknown].freeze
HIGH_CONFIDENCES =
%w[high certain].freeze
MAX_ENTRIES =
100_000
MAX_INPUT_BYTES =
16 * 1024 * 1024
MAX_STRING_BYTES =
4_096

Instance Method Summary collapse

Constructor Details

#initialize(manifest:, repository_root:, reports:, diagnostics:) ⇒ CandidateUnion

Returns a new instance of CandidateUnion.



16
17
18
19
20
21
# File 'lib/necropsy/bench/candidate_union.rb', line 16

def initialize(manifest:, repository_root:, reports:, diagnostics:)
  @manifest = manifest
  @repository_root = repository_root
  @reports = reports
  @diagnostics = diagnostics
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/necropsy/bench/candidate_union.rb', line 23

def call
  validate_inputs!
  load_necropsy_candidates
  load_external_candidates
  discard_diagnostic_only_rows
  apply_labels
  fill_tool_results
  result = {
    'schema_version' => 1,
    'tool_runs' => tool_runs.sort.to_h,
    'summary' => summary,
    'identity' => {
      'primary' => 'definition_id',
      'legacy_fallback' => 'id',
      'legacy_mapping' => 'logical candidates and labels apply to every matching physical definition'
    },
    'candidates' => candidates.values.sort_by { |candidate| candidate_sort_key(candidate) }
  }
  validate_result!(result)
  result
end