Stop code smells and AI slop before they reach main.
smells scans Rust, Python, and TypeScript for 23 classic code smells (28 rules grounded in Fowler & Beck's Refactoring, Mäntylä & Lassenius's taxonomy, and Refactoring.Guru, plus CRAP risk scores). It is one fast native binary, gives the exact same result every run, and never executes your code. Point it at main with --base and it blocks only smells your branch adds or makes worse—no baseline file to maintain, so legacy debt never blocks a commit.
Pick one channel—every one ships the same native binary:
uv tool install smells==0.7.0 # Python
npm install --save-dev --save-exact @mindful-time/smells@0.7.0 # Node
cargo install --locked --version 0.7.0 smells # RustStandalone binaries for macOS, Linux, and Windows are on the v0.7.0 release page.
Run smells doctor in any Rust, Python, or TypeScript repo—no flags or policy file needed:
smells doctorCodebase Health
██████████████████░░ 90/100 Great
1 files · 1 blocking · 0 ignored · 0 review warnings · 1/23 smells matched
Smells (hard blockers first)
Smell Category Blocking Ignored Review
Long Parameter List bloaters 1 0 0
Next steps
1. smells check
smells doctor checks your setup (policy, Git history, coverage, AGENTS.md, CODEOWNERS), prints your 0–100 health score and burndown, and tells you the exact next step. If it can't find LCOV coverage, it offers to run your coverage tool so CRAP scores use real numbers.
Save a starter policy for your language (Python, TypeScript, or Rust) and check your branch against main:
curl -fsSLo quality-policy.json \
https://raw.githubusercontent.com/mindful-time/smells/v0.7.0/examples/python-quality-policy.json
smells check --base origin/mainScan summary | verdict: blocked_by_required_patterns | findings: 2 | blocking: 1 | ignored: 0 | review: 1 | errors: 0 | base: origin/main | legacy: 0 | delta: +1 | new_ignores: 0
F000001 | blocking | python.function_arguments | orders.py:1:1
Finding Log: smells-findings.log
Start at the Issue Index, then read every referenced detail.
- Terminal output stays compact; full details go to
smells-findings.logwith blockers at the top. - Each finding explains why it matched, links to its reference guide, and includes embedded
when_to_ignoreguidance. - Leave off
--baseto check the whole repository. Addsmells-findings.log,smells-report.json, andlcov.infoto.gitignore.
| Exit | Meaning |
|---|---|
0 |
Clean (no new or worse blocking smells; review warnings may still be in the log) |
1 |
A blocking smell was added or got worse—fix it |
2 |
The scan couldn't finish (bad policy, parse error, shallow clone, unused ignore…). Never clean |
- Hard blockers vs. review warnings: Starter policies block on Long Method, Long Parameter List, Large Class, Duplicate Code, and Dead Code (
"mode": "required"). All other smells still run as non-blocking review signals ("mode": "report"). Flip any rule to"required"inquality-policy.jsonwhenever you want it to block. - Ignoring intentional code: Only when a finding's
when_to_ignoreguidance genuinely applies, place a comment right above the declaration with the exact rule ID and reason (//in Rust and TypeScript):
# smells: ignore[python.function_arguments] -- stable external API
def publish(a, b, c, d, e, f, g, h):
...Ignored findings stay visible in reports. Unknown, malformed, or unused ignores exit 2.
--staged scans the exact Git index snapshot you are about to commit. With pre-commit:
repos:
- repo: local
hooks:
- id: smells
name: smells
language: system
entry: uvx --from smells==0.7.0 smells check --staged --base HEAD
pass_filenames: falseNode projects can use npx --no-install smells check --staged --base HEAD; Rust projects can call smells check --staged --base HEAD directly. A commit that adds a new smells: ignore blocks by default so every suppression gets reviewed (commit with --no-verify once approved).
Copy a fail-closed template from examples/ci/: GitHub Actions, Azure Pipelines, and CODEOWNERS. Always fetch full history (fetch-depth: 0)—shallow clones exit 2 instead of reporting history rules clean. See CI setup.
No MCP server or plugin needed—works with Claude Code, Codex, Pi, and any agent that runs CLI commands. Add this to AGENTS.md (and @AGENTS.md to CLAUDE.md for Claude Code):
## Smell review
- Run `smells check --base origin/main --report smells-report.json` before reviewing or refactoring code smells.
- Treat exit code `2` as an incomplete scan, never as clean.
- Open `smells-findings.log`, start at the Issue Index, and fix every `scanner_error` and `blocking` finding first.
- Before fixing or ignoring a finding, read its reference URL and `when_to_ignore` guidance.
- Add `smells: ignore[exact-rule-id] -- reason` only when that guidance really applies, never just to pass a hook.
- Make small, behavior-preserving edits, then rerun tests and `smells check`.| Language | Files | Starter policy |
|---|---|---|
| Rust | .rs |
quality-policy.json |
| Python | .py, .pyi |
python-quality-policy.json |
| TypeScript | .ts, .tsx, .mts, .cts |
typescript-quality-policy.json |
All 23 smells (28 rules), checked in every language
| Category | Smells |
|---|---|
| Bloaters | Long Method, Large Class, Primitive Obsession, Long Parameter List, Data Clumps |
| OO Abusers | Alternative Classes with Different Interfaces, Refused Bequest, Switch Statements, Temporary Field |
| Change Preventers | Divergent Change, Parallel Inheritance Hierarchies, Shotgun Surgery |
| Dispensables | Comments, Duplicate Code, Data Class, Dead Code, Lazy Class, Speculative Generality |
| Couplers | Feature Envy, Inappropriate Intimacy, Incomplete Library Class, Message Chains, Middle Man |
Definitions and provenance are embedded in rules/sources-v1.json and rules/concept-catalog-v1.json (Fowler & Beck 1e/2e, Mäntylä & Lassenius 2006, Refactoring.Guru, plus research candidates from Lanza–Marinescu 2006 and DECOR 2010).
Not supported yet: Java, Kotlin, JavaScript, and JSX. smells complements your compiler, type checker, tests, and security tools—it does not replace them.
| Command | What it does |
|---|---|
smells doctor |
Zero-config health score, smell table, burndown, setup checks, and next steps |
smells check |
Scan the current folder (--base REF checks only changes; --path DIR scans another folder) |
smells check --staged --base HEAD |
Scan staged files before committing |
smells policy show |
Show active rules and thresholds in your policy |
smells contracts validate |
Validate your policy file |
smells rules |
List every rule in a language pack |
Run smells --help for every flag.
- Project integration: policies, monorepos, test & migration roles, coverage/CRAP, CI
- Report format &
--baseratchet - Rule contracts: Rust · Python · TypeScript
- Internals: Architecture · Migration analysis · Provider evidence · Distribution · Releases · Governance
Every package is built from one signed, immutable GitHub Release with checksums and CycloneDX/SPDX SBOMs. Run make pre-commit-push before committing or pushing; pull requests come from a fork.