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

Function calls

__tests__/python-declared-import-roots.test.ts:181–190  ·  view source on GitHub ↗

What the function `name` calls, as `target@file`.

(cg: CodeGraph | undefined, name: string)

Source from the content-addressed store, hash-verified

179
180 /** What the function `name` calls, as `target@file`. */
181 function calls(cg: CodeGraph | undefined, name: string): string[] {
182 const from = cg!.getNodesByKind('function').find((n) => n.name === name);
183 expect(from, name).toBeDefined();
184 return cg!
185 .getOutgoingEdges(from!.id)
186 .filter((e) => e.kind === 'calls')
187 .map((e) => cg!.getNode(e.target)!)
188 .map((n) => `${n.name}@${n.filePath.replace(/\\/g, '/')}`)
189 .sort();
190 }
191
192 /** Both tests of a service: through `import mod` and through `from mod import check`. */
193 function reached(cg: CodeGraph | undefined, name: string): string[][] {

Callers 2

reachedFunction · 0.70

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesByKindMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected