Files
simplify-code/rules/python/complexity.yml
T
Giancarmine SalucciandClaude Opus 4.8 3f6f642f6b feat: portable cross-runtime code-simplification skill
ast-grep-driven detection + ranking into a JSON ledger, two-track apply
(deterministic autofix + model span-edits), configurable report/apply modes.
Rule packs for JS/TS, Python, Go, Rust, Java; Svelte/SvelteKit support via
project tooling + opt-in grammar. Runtime-neutral SKILL.md (Agent Skills spec).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 00:54:40 +02:00

44 lines
945 B
YAML

# Python — complexity smells (detection only, no `fix:` → Track B / semantic).
id: py-deep-nesting
language: Python
severity: warning
message: "Deeply nested conditional (>=3 levels) — consider guard clauses / early returns."
rule:
kind: if_statement
inside:
kind: if_statement
stopBy: end
inside:
kind: if_statement
stopBy: end
---
id: py-long-param-list
language: Python
severity: warning
message: "Long parameter list (>=5) — consider a dataclass / parameter object."
rule:
kind: parameters
has:
any:
- kind: identifier
- kind: typed_parameter
- kind: default_parameter
nthChild: 5
---
id: py-magic-number
language: Python
severity: info
message: "Magic number in an expression — consider a named constant."
rule:
kind: integer
not:
regex: "^(0|1|2|10|100|1000)$"
inside:
any:
- kind: binary_operator
- kind: comparison_operator
stopBy: end