-
Notifications
You must be signed in to change notification settings - Fork 0
Detector: Dead Code
Jacob Centner edited this page Apr 10, 2026
·
1 revision
Identifies exported functions, classes, and constants that are never imported elsewhere in the codebase.
| Property | Value |
|---|---|
| Name | dead-code |
| Tier | HEURISTIC |
| Languages | Python, JavaScript/TypeScript |
| External tool | None (Python ast + regex) |
| LLM required | No |
| Confidence | 0.70 (Python), 0.60 (JS/TS) |
Exported symbols (functions, classes, constants) that are never imported or referenced by any other module in the codebase.
- Parses each module with
astto collect exported names - Respects
__all__— if defined, only those names are considered exports - Skips private/underscore-prefixed names,
__init__.py,conftest.py,setup.py - Tracks intra-file references (an exported function used within its own module is not dead)
- Cross-references all imports across the codebase
- Uses regex to extract
exportdeclarations - Tracks
importstatements and dynamicimport()calls - Skips auto-generated files (detected by header comment patterns)
- Extensive
_JS_ALWAYS_USEDallowlist for framework hooks (Next.js, React, test lifecycle)
-
Python: ~80+ names including dunder methods (
__init__,__str__), framework hooks (setUp,tearDown), test fixtures, PEP 517 build hooks -
JS/TS: Next.js lifecycle (
getServerSideProps,generateMetadata), test hooks (beforeEach,afterAll), HTTP handlers
[DEAD-CODE] src/sentinel/core/runner.py:_legacy_format_output
Exported function never imported elsewhere in the codebase
Severity: LOW, Confidence: 0.70
| Repo | Findings | TP Rate | Notes |
|---|---|---|---|
| pip-tools | 0 | N/A | Clean |
| httpx | 0 | N/A | Clean |
| shadcn-ui/ui | 1692 | ~1% | JS monorepo — dynamic imports, registry patterns |
| bubbletea | 0 | N/A | Go not supported |
-
JS/TS monorepos: High false-positive rate when exports are consumed via dynamic
import(), registry patterns, or cross-package barrel re-exports. The lower 0.60 confidence reflects this. - Does not track re-exports across package boundaries in monorepos
- No Go or Rust support
Local Repo Sentinel · MIT License
Getting Started
Reference
Detectors
- Detector: Todo Scanner
- Detector: Complexity
- Detector: Dead Code
- Detector: Dep Audit
- Detector: Docs Drift
- Detector: Unused Deps
- Detector: Lint Runner
- Detector: ESLint Runner
- Detector: Go Linter
- Detector: Rust Clippy
- Detector: Git Hotspots
- Detector: Stale Env
- Detector: Semantic Drift
- Detector: Test Coherence
- Detector: CI/CD Drift
- Detector: Architecture Drift
- Detector: Inline Comment Drift
- Detector: Intent Comparison
Advanced
Workflow