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

Function callees

__tests__/python-self-attribute-call.test.ts:39–49  ·  view source on GitHub ↗

The `calls` edges out of a function or method named `caller`, as `name@file`.

(caller: string)

Source from the content-addressed store, hash-verified

37
38/** The `calls` edges out of a function or method named `caller`, as `name@file`. */
39function callees(caller: string): string[] {
40 const from = [...cg!.getNodesByKind('function'), ...cg!.getNodesByKind('method')].filter((n) => n.name === caller);
41 expect(from.length, `${caller} should be indexed`).toBeGreaterThan(0);
42 return from
43 .flatMap((n) => cg!.getOutgoingEdges(n.id))
44 .filter((e) => e.kind === 'calls')
45 .map((e) => cg!.getNode(e.target))
46 .filter((n): n is NonNullable<typeof n> => !!n)
47 .map((n) => `${n.qualifiedName}@${n.filePath}`)
48 .sort();
49}
50
51describe('a Python call on self or cls (#2958)', () => {
52 it("the issue's repro: an attribute set from a parameter is not another file's function", async () => {

Calls 4

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

Tested by

no test coverage detected