Class: Necropsy::Analyzers::Dynamic::CoverbandImporter

Inherits:
Necropsy::Analyzer show all
Defined in:
lib/necropsy/analyzers/dynamic/coverband_importer.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CoverbandImporter

Returns a new instance of CoverbandImporter.



13
14
15
# File 'lib/necropsy/analyzers/dynamic/coverband_importer.rb', line 13

def initialize(config)
  @config = config || {}
end

Instance Method Details

#analyze(graph, project) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/necropsy/analyzers/dynamic/coverband_importer.rb', line 17

def analyze(graph, project)
  source = config['source']
  return AnalyzerResult.empty unless source

  payload = load_payload(source, project.root)
  alive = alive_from_payload(graph, payload).map do |node|
    AliveEvidence.new(
      node_id: node.id,
      evidence: evidence(kind: :alive, details: "Coverband executed #{node.file}:#{node.line}",
                         metadata: payload['observation'] || {})
    )
  end

  AnalyzerResult.new(
    edge_evidences: [],
    alive_evidences: alive,
    uncertainties: {},
    observation: { 'coverband' => payload['observation'] || {} }
  )
end

#profileObject



38
39
40
41
42
43
44
45
# File 'lib/necropsy/analyzers/dynamic/coverband_importer.rb', line 38

def profile
  AnalyzerProfile.new(
    name: :coverband,
    kind: :dynamic,
    soundness: :observational,
    description: 'Imports file and line execution data compatible with coverband-style exports.'
  )
end