Skip to content

Latest commit

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

deadcode

60+ patterns5 languagesMIT LicenseClawHubZero telemetry

Find the code nobody uses. Remove it before it rots.

Website · Quick Start · Languages · Pricing


Your codebase has dead code. A lot of it.

Studies show 10-30% of code in a typical project is dead. Unused exports. Orphan files nobody imports. Commented-out blocks from three sprints ago. Console.log statements that survived code review. Functions with pass as the body. CSS classes that match no element.

Dead code is not harmless. It slows onboarding. It confuses grep. It inflates bundles. It creates false positives in security scans. And it grows.

DeadCode finds the rot before it spreads. Pre-commit hooks. Local scanning. 60+ patterns across 5 language categories. Zero data leaves your laptop.

Quick Start

# 1. Install via ClawHub (free)
clawhub install deadcode
# 2. Scan your repo
deadcode scan
# 3. Install pre-commit hooks (Pro)
deadcode hooks install

That's it. Every commit is now scanned for dead code before it lands.

What It Does

Scan source files for dead code

One command to scan any file, directory, or your entire repo. 60+ regex patterns detect dead code across JavaScript/TypeScript, Python, Go, CSS/SCSS, and general code cruft.

Block commits with pre-commit hooks

Install a lefthook pre-commit hook that scans every staged source file. If dead code is detected, the commit is blocked with a clear cleanup message.

Generate dead code reports

Produce markdown reports with severity breakdowns, orphan file detection, and cleanup priority. Ideal for tech debt tracking and sprint planning.

Find orphan files

Detect files that are never imported, required, or referenced by any other file. Excludes entry points, test files, and config files automatically.

Manage ignore rules

Define organization-specific ignore patterns and check IDs. Skip known false positives without disabling entire categories.

SARIF output for CI/CD

Generate SARIF v2.1.0 output compatible with GitHub Code Scanning, Azure DevOps, and other CI systems.

How It Compares

FeatureDeadCodets-prune ($0)knip ($0)vulture ($0)deadcode (Go) ($0)
JavaScript/TypeScriptYesYesYesNoNo
Python dead codeYesNoNoYesNo
Go dead codeYesNoNoNoYes
CSS/SCSS dead codeYesNoNoNoNo
Multi-language scanYesNoPartialNoNo
Pre-commit hooksYesNoNoNoNo
Orphan file detectionYesNoYesNoNo
Zero config scanYesConfig requiredConfig requiredYesYes
Offline license validationYesN/AN/AN/AN/A
Local-only (no cloud)YesYesYesYesYes
Zero telemetryYesYesYesYesYes
SARIF outputYesNoNoNoNo
ClawHub integrationYesNoNoNoNo
Price (individual)Free/$19/moFreeFreeFreeFree

Supported Languages

DeadCode detects 60+ dead code patterns across 5 language categories:

JavaScript/TypeScript

CheckSeverityDescription
Unused exportsCriticalExported functions/classes/constants never imported elsewhere
Orphan filesHighFiles never imported or required by any other file
console.log/debugMediumConsole statements left in production code
Commented-out codeMediumLarge blocks of commented-out code
Unreachable codeHighCode after return/throw/break/continue statements
Empty function bodiesMediumFunctions with empty bodies (no-op)
Unused variablesHighVariables declared but never referenced
Dead switch casesMediumSwitch case branches with no code
Deprecated markersLow@deprecated JSDoc tags indicating dead code
Empty catch blocksMediumCatch blocks that swallow errors silently
TODO/FIXME/HACKLowComments indicating incomplete or temporary code
Triple-slash refsLowStale triple-slash reference directives

Python

CheckSeverityDescription
Unused functionsHighFunctions defined but never called in module
Unused importsHighImports that are never used
pass-only bodiesMediumFunctions/classes with only pass as body
Commented-out codeMediumLarge blocks of commented-out code
Unreachable codeHighCode after return/raise/break
all mismatchesMediumExports in all that don't match definitions
Empty except blocksMediumExcept blocks that silently swallow exceptions
Dead else branchesLowUnreachable else branches

Go

CheckSeverityDescription
Unused importsHighImports not used in the file
Dead exported funcsHighExported functions never called from tests or packages
Unreachable codeHighCode after return/panic statements
Empty function bodiesMediumFunctions with empty bodies
Commented-out codeMediumLarge blocks of commented-out code
Empty init()Mediuminit() functions that do nothing

CSS/SCSS

CheckSeverityDescription
Unused selectorsHighCSS classes/IDs never referenced in source files
Empty rule blocksMediumSelectors with no declarations
Duplicate selectorsMediumSame selector declared multiple times
Commented-out stylesLowLarge blocks of commented-out CSS
!important overuseMediumMore than 5 !important declarations in a file
Unused CSS variablesHighCustom properties defined but never referenced
Empty media queriesMediumMedia queries with no rules inside
Vendor prefixesLowVendor prefixes that autoprefixer should handle

General

CheckSeverityDescription
Orphan filesHighFiles not imported/referenced by any other file
Large comment blocksMedium10+ consecutive comment lines
TODO/FIXME densityMediumMore than 5 TODO/FIXME/HACK per file
Debug/test codeHighDebug or test code left in production files
Feature flag remnantsMediumFeature flags referencing removed features
Placeholder textLowLorem ipsum, TODO: implement, and other placeholder text

Pricing

FeatureFreePro ($19/user/mo)Team ($39/user/mo)
One-shot dead code scan5 filesUnlimitedUnlimited
60+ detection patternsYesYesYes
Auto-detect languagesYesYesYes
Pre-commit hooksYesYes
Dead code reportsYesYes
Orphan file detectionYesYes
Custom ignore rulesYes
SARIF outputYes
CI/CD integrationYes
Cross-repo analysisYes

Configuration

Add to ~/.openclaw/openclaw.json:

{
"skills": {
"entries": {
"deadcode": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY",
"config": {
"severityThreshold": "high",
"ignorePatterns": ["**/test/**", "**/fixtures/**", "**/*.spec.*"],
"ignoreChecks": ["DC-JS-011"],
"reportFormat": "markdown"
}
}
}
}
}

Ecosystem

DeadCode is part of the ClawHub code quality suite:

Privacy

  • 100% local -- no code sent externally
  • Zero telemetry
  • Offline license validation
  • Pattern matching only -- no AST parsing, no external dependencies

License

MIT

About

💀 Dead code & unused export detector — 60+ patterns across JS/TS, Python, Go, CSS. Pre-commit hooks, SARIF output, 100% local.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages