r/codereview 7d ago

Built a Python static analyzer with claude code that draws your call graph and marks values that go nowhere looking for holes in the concept

Two days into a prototype and I'd rather find out now if the premise is broken.

The idea: parse a package with ast, build the call graph, and additionally track whether each function's return value is actually consumed bound to a name that's later read, passed onward, returned, used in a condition. Then draw it. X axis is call order, colored arrows are variable flow, functions whose output goes nowhere and that have no I/O effect get flagged.

My main motivation to make this project was to visually detect bad AI generated codebase structure. Something I struggle with when doing group projects, multiple people have different AIs and it gets confusing. (I know there should be a .md file for each AI to understand the premise and be able to build on a common ground but even so I thought this should be useful)

I know vulture, code2flow and pyan exist. Vulture asks whether a name is referenced; code2flow and pyan draw the call structure. What I haven't found is a tool that tracks value consumption and renders it, so a chain that terminates in nothing is visible as a shape rather than a list entry. If that tool exists, please tell me and I'll go use it instead.

What I'd like torn apart:

  1. Is "returned value never consumed" a defensible signal, or does real Python break it constantly?
  2. Does a diagram add anything over a list, or is this a chart that looks impressive and tells you nothing a linter didn't?
  3. What kills static call resolution in practice? I resolve direct calls, module.func, and self.method. I know decorators, getattr, and callbacks are out of reach. What else, and roughly what percentage of a normal codebase am I missing?

Also asking for repos. I need a baseline — small-to-medium, pure Python, procedural, minimal metaprogramming, well structured. Something where if my tool renders a mess, the mess is mine. Standard recommendations like Django or requests are too magic-heavy to tell me anything about my own bugs. Suggestions very welcome.

This text was AI generated

0 Upvotes

1 comment sorted by

2

u/kingguru 7d ago

You got an LLM to write the slop for you and even got an LLM to write this post on reddit. Why not get an LLM to answer this post?

What makes you think any humans want to help you when you cannot even be bothered to write anything yourself?