-
Notifications
You must be signed in to change notification settings - Fork 0
Detector: Unused Deps
Jacob Centner edited this page Apr 10, 2026
·
1 revision
Flags declared dependencies that are never imported in source code.
| Property | Value |
|---|---|
| Name | unused-deps |
| Tier | DETERMINISTIC |
| Languages | Python, JavaScript/TypeScript |
| External tool | None (AST + regex) |
| LLM required | No |
| Confidence | 0.80 |
Dependencies declared in pyproject.toml, requirements.txt, or package.json that have no corresponding import in source files.
-
Reads declared deps from:
- Python:
pyproject.toml(PEP 621 + Poetry),requirements.txt - JS/TS:
package.json(dependencies + devDependencies)
- Python:
-
Collects imports from source files:
- Python: Full AST parsing of
importandfrom ... importstatements - JS/TS: Regex matching of
import,require(), and dynamicimport()
- Python: Full AST parsing of
-
Compares using a package-name → import-name mapping table for packages where the name differs from the import (e.g.,
Pillow→PIL,scikit-learn→sklearn,PyYAML→yaml) - Filters tool packages that are never imported (pytest, ruff, mypy, etc.)
Extensive allowlists prevent false positives for packages that are used as tools, not imported:
-
Python: ~50 packages (pytest, ruff, mypy, coverage, mkdocs, pre-commit, sphinx, twine, etc.) plus prefix patterns (
pytest_*,flake8_*,types_*, etc.) -
JS/TS: ~40 packages (eslint, prettier, webpack, vite, typescript, etc.) plus prefix patterns (
eslint-config-*,eslint-plugin-*,@typescript-eslint/*,prettier-plugin-*) -
Build system:
[build-system].requirespackages are automatically excluded
[UNUSED-DEPS] package.json — "motion"
Declared as dependency but no import found in source files
Severity: LOW, Confidence: 0.80
| Repo | Findings | TP Rate | Notes |
|---|---|---|---|
| pip-tools | 0 | N/A | Clean (after filtering) |
| httpx | 0 | N/A | All were tool packages |
| shadcn-ui/ui | 1 | ~50% |
motion — CSS-only usage |
- Cannot detect CSS-only or runtime-resolved package usage
- Allowlists need expansion as new tool ecosystems emerge (continuously improving)
- 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