NeuroScan

I ran a structural scan on 10 popular Python repositories. Here is what it found.

Everyone uses requests, flask, fastapi, pydantic. These are the libraries we trust with our HTTP calls, our schemas, our CLIs. So I pointed a static analyzer at ten of them and read the output.

Not a linter. Ruff and pylint check lines. This thing parses the project into a call graph — modules, classes, functions, and who calls whom — and then asks questions that only make sense with that graph: which class owns 66 methods, which function is called from 23 places, which two modules import each other, which two functions are the same code written twice.

The whole batch — 1,304 files, 260,100 lines of Python — took 216 seconds, about 1,200 lines per second, with no model involved. The scan of fastapi (553 files) took 26 seconds.

The numbers

RepositoryFilesLinesFindingsScan
celery/celery21850,6291,05233 s
encode/django-rest-framework7415,71633720 s
scrapy/scrapy20739,92918625 s
pydantic/pydantic6342,74916423 s
fastapi/fastapi55334,86516327 s
Textualize/rich10538,4719725 s
pallets/click1712,9458513 s
psf/requests206,4034718 s
pallets/flask249,5664517 s
encode/httpx238,8272618 s

2,202 findings in total. That number is too big to mean anything on its own, so here is the honest split: 905 of them are no_contract — a function with no docstring saying what it promises. That is a style rule, not a defect, and I would not put it on a slide. Strip those and the substantive count is 1,297.

Five patterns that are worth a look

1. Wide signatures — 279 findings. rich._log_render.LogRender.__call__ takes 8 parameters. rich.json.JSON.__init__ takes 9. click has 22 of these. A call site of a nine-argument function is a row of positional values nobody can read without opening the definition; the analyzer flags it when the parameters can be grouped into a structure or a keyword object.

2. God classes — 39 findings. rich.console.Console has 66 methods. rich.text.Text has 53, rich.style.Style has 33. A class that owns the terminal, the styles, the cursor, the export formats and the protocol handling is a class where every change touches everything.

3. Import cycles — 11 findings. rich.__main__ sits in a cycle of 36 modules (rich.__main__ → rich._log_render → rich._palettes → … → back). celery.utils.collections is in a three-module cycle with celery.utils.functional. Cycles are not always fatal — Python tolerates them until an import happens in the wrong order — but they are why "it works in tests, fails on import" bugs exist.

4. Swallowed errors — 19 findings. rich.pretty.traverse._traverse catches an exception at line 645 and drops it silently. So does celery.backends.base.Backend._handle_group_chord_error at line 556. This is the check I care about most: a bare except: pass is a decision to hide a failure, and it is invisible in review.

5. Duplicates and hubs — 63 and 37 findings. rich.live.Live.__exit__, rich.progress.Progress.__exit__ and rich.progress_bar.ProgressBar.__exit__ are the same code three times. rich.console.Console.print is called from 23 places; get_style from 20. A hub is not a bug — it is a place where a small change has a wide blast radius.

What the scan cannot see

public API. The analyzer marks those as open when it cannot prove it.

finding on a method that a framework calls by name is a false positive, and the report says so.

checklist, not a score.

Why I am writing this

I built the analyzer (NeuroScan). The honest reason for this post is that "static analysis finds things" is a claim, and claims need artifacts. So every repository above has a public report page — the same tree, the same checks, the same numbers — linked from the site: neuromomen.com/reports. No sign-up, no demo video, just the output.

What I would like from you is not a signup. It is a correction: if a finding on your project is wrong, tell me. A false positive in a public report of a repo you maintain is the fastest way for me to find a bug in the analyzer, and I would rather have that than a nice number.

Scan your own, if you want: five projects are free.