Class: Necropsy::Analyzers::Static::CHA

Inherits:
Necropsy::Analyzer show all
Defined in:
lib/necropsy/analyzers/static/cha.rb

Instance Method Summary collapse

Instance Method Details

#analyze(graph, _project) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/necropsy/analyzers/static/cha.rb', line 7

def analyze(graph, _project)
  edge_evidences = graph.call_sites.flat_map do |site|
    resolve(graph, site).map do |candidate|
      EdgeEvidence.new(
        caller_id: site.caller_id,
        callee_id: candidate.id,
        evidence: evidence(
          kind: :call_edge,
          details: "CHA candidate at #{site.file}:#{site.line}",
          metadata: site.to_h
        )
      )
    end
  end

  AnalyzerResult.new(
    edge_evidences: edge_evidences,
    alive_evidences: [],
    uncertainties: {},
    observation: {}
  )
end

#profileObject



30
31
32
33
34
35
36
37
# File 'lib/necropsy/analyzers/static/cha.rb', line 30

def profile
  AnalyzerProfile.new(
    name: :cha,
    kind: :static,
    soundness: :conservative,
    description: 'Expands call targets through class hierarchy, descendants, and included/prepended modules.'
  )
end