Skip to main content

Find and auto-delete dead code across 9 languages — with git intelligence and auto PR

Project description

☠ Dead Code Archaeologist

Find unused functions. Delete them safely. Open a PR. All in one command.

Dead Code Archaeologist scans your codebase for dead functions using a multi-signal confidence engine — combining static call graph analysis with git history — then automatically deletes them on an isolated branch, runs your test suite, and opens a GitHub PR.

Install

pip install deadcode-archaeologist

Quick start

# Scan and see what's dead (no changes)
deadcode ./my-project --explain

# Generate a full interactive HTML report
deadcode-report ./my-project

# Preview what would be deleted (safe — no changes)
deadcode-clean ./my-project --dry-run

# Full auto-clean: delete → test → branch → PR
deadcode-clean ./my-project --min-confidence 85

How it works

  1. AST scan — tree-sitter parses every function definition and call across all supported languages
  2. Git analysis — last commit date, author count, and commit frequency per file
  3. Confidence scoring — 5 signals combine into a 0–100 score
  4. Surgical deletion — functions removed by precise byte ranges, no broken syntax
  5. Tests run — your test suite runs automatically before anything is committed
  6. PR opened — a GitHub PR with full per-function documentation

Supported languages

Python, Dart/Flutter, JavaScript, TypeScript, Go, Java, Rust, Kotlin, Ruby, Swift

Commands

Command What it does
deadcode ./src --explain Scan and print ranked table
deadcode ./src --json-output Output results as JSON
deadcode-report ./src Generate HTML dashboard
deadcode-clean ./src --dry-run Preview deletions, no changes
deadcode-clean ./src --min-confidence 85 Full auto-clean + PR
deadcode-clean ./src --no-pr Clean without opening PR
deadcode-clean ./src --lang dart Only clean Dart files

Confidence score

Signal Points
Zero callers in codebase +45
Git age (2+ years untouched) +20
Single author ever +15
Callers are themselves dead +10
Very few commits (≤2) +10

Verdicts

  • Safe to delete (80–100) — multiple signals agree, auto-deleted by deadcode-clean
  • Review first (50–79) — likely dead, verify manually before deleting
  • Needs runtime data (40–49) — may be called dynamically, add coverage tracing first

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archaeologist-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

archaeologist-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file archaeologist-0.1.0.tar.gz.

File metadata

  • Download URL: archaeologist-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a5c5c586f1bfc26be4468eda943e245dc2316892c2b4b606a287eebc970258a
MD5 a0efe211e17bbf6f7e75ec51ec978cb6
BLAKE2b-256 b5897ba3a64ee764a6addb8d7f9f49bdfca65e103d6c5c07660fd8a6acfdb4db

See more details on using hashes here.

File details

Details for the file archaeologist-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: archaeologist-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for archaeologist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12c988a18817a5aea2b52e4a19e31e080217a90c2597f51b0d0990da892e67b1
MD5 acd3993c2f59a1de9a832c61b93d4ac7
BLAKE2b-256 c843d763e564f1a43384986980309b7c761d7f317e033f90093577e6041b44e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page