fix: improve call graph accuracy -- filter method call noise, add Kotlin support#106
fix: improve call graph accuracy -- filter method call noise, add Kotlin support#106gzenz wants to merge 1 commit intotirth8205:mainfrom
Conversation
…lin support
Method calls like obj.method(), response.json(), data.get() were recorded
as bare CALLS targets ("method", "json", "get"), polluting the graph with
unresolvable noise and creating false callers via name collisions.
Now only self/cls/this/super method calls emit CALLS edges -- these resolve
within the class. External method calls are dropped (unresolvable without
type inference). On this repo: 58% fewer CALLS edges, but only 6% fewer
resolved edges -- almost all useful relationships preserved.
Also adds Kotlin call extraction (simple_identifier + navigation_expression)
which was completely missing.
|
This PR addresses call graph noise (obj.method() creating false CALLS edges) and adds Kotlin call extraction. The changes are substantial (58% reduction in noisy CALLS edges) and all tests pass. Let me check if this has been integrated into main... |
|
The call graph noise filtering (only emit CALLS for self/cls/this method calls, filter out obj.method()) does not appear to be in main — the current parser.py extracts method names from all member_expression calls without filtering by receiver type. The 58% noise reduction and Kotlin call extraction this PR provides are still not in main. Worth reviving — this would significantly improve call graph accuracy and reduce false positives. |
|
The noise filtering from this PR is fully included in #158 — same core logic (only allow self/cls/this/super receivers) plus additional refinements: uppercase receivers for class/static calls, namespace import receivers checked against the import map, nested member expression resolution (os.path.getsize), and a test-file exception to preserve TESTED_BY edges. Closing in favor of #158. |
|
Noise filtering is included in #158 with additional improvements (see comment above). Closing. |
Summary
obj.method(),response.json(),data.get()were recorded as bare CALLS targets (method,json,get), polluting the graph with unresolvable noise and creating false callers via name collisions. Now onlyself/cls/this/supermethod calls emit CALLS edges.simple_identifierandnavigation_expressionin its tree-sitter AST, which were not handled -- producing zero CALLS edges for Kotlin files.Impact (measured on this repo, Python-only)
Almost all meaningful call relationships preserved (6% drop). The 58% total drop is noise removal.
Test plan
test_method_call_filtering_python_self--self.method()emits CALLStest_method_call_filtering_python_external--obj.method()does nottest_method_call_filtering_python_super--super().method()emits CALLStest_method_call_filtering_ts_this--this.method()emits CALLStest_method_call_filtering_ts_external--obj.method()does nottest_finds_calls--println()works,repo.save()filtered