Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I priced my own dead code and got a $775 bill

Описание и применение

Автор создал инструмент GhostCode, который анализирует AST и выявляет мертвый код, оценив его стоимость в 775,49 долларов в год. Удалив неиспользуемые файлы, он сократил репозиторий и включил анализ в CI.

Задача

Dead code incurs ongoing maintenance costs that are hard to quantify.

Результат

GhostCode identified 10 unused files and 21 unused symbols, revealing $775.49 of annual maintenance cost. Deleting a helper module reduced the repo size and kept tests green.

Рабочий процесс

  • 1. Parse Python and JS/TS files with tree-sitter to obtain ASTs.
  • 2. Convert ASTs into a NetworkX graph of files, functions, classes, and imports.
  • 3. Identify ghost nodes as those with zero incoming edges.
  • 4. Apply three scorers: dead-code confidence, debt (complexity), and cost (LOC × $0.50 × complexity).
  • 5. Present results on a Next.js dashboard backed by a FastAPI API.
  • 6. Use PyGithub to create deletion pull requests automatically.
  • 7. Run the analyzer in CI to maintain the graveyard size.

Доказательства

GhostCode, a dead-code analyzer that reads your AST instead of guessing from text

Источник

The scan found 10 ghost files and 21 ghost symbols. Three circular import chains I didn't know about. Total: $775.49 of annual maintenance burn

Источник

A helper module I was "keeping in case I need it later" turned out to have zero incoming edges from day one. It was never needed. Deleting it took one PR and the tests stayed green, 91 out of 91.

Источник

  • Дата записи: 2026-10-18T08:56:06.538Z