MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callsFrom

Function callsFrom

__tests__/require-missing-member.test.ts:43–53  ·  view source on GitHub ↗

`caller -> file:qualifiedName` for every `calls` edge out of `file`.

(graph: CodeGraph, file: string)

Source from the content-addressed store, hash-verified

41
42/** `caller -> file:qualifiedName` for every `calls` edge out of `file`. */
43function callsFrom(graph: CodeGraph, file: string): string[] {
44 const out: string[] = [];
45 for (const node of graph.getNodesInFile(file)) {
46 for (const e of graph.getOutgoingEdges(node.id)) {
47 if (e.kind !== 'calls') continue;
48 const target = graph.getNode(e.target)!;
49 out.push(`${node.name} -> ${target.filePath}:${target.qualifiedName}`);
50 }
51 }
52 return out.sort();
53}
54
55const DECOY = 'export class Decoy { missing() { return 42; } render() { return 1; } create() { return 2; } }\n';
56

Callers 1

Calls 4

getNodeMethod · 0.80
pushMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected