Class: Necropsy::Analyzers::Static::NameResolution

Inherits:
Necropsy::Analyzer show all
Defined in:
lib/necropsy/analyzers/static/name_resolution.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/name_resolution.rb', line 7

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

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

#profileObject



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

def profile
  AnalyzerProfile.new(
    name: :name_resolution,
    kind: :static,
    soundness: :unsound,
    description: 'Resolves Ruby call sites by exact receiver and method name, falling back to same-name candidates.'
  )
end