name: validate-and-fix description: After completing code changes, runs tests and pre-commit, then iteratively fixes failures until all pass. Use when finishing a coding task, validating changes, or when the user asks to run tests or fix errors.
Validate and Fix
Workflow
- Run tests:
uv run pytest -m "not slow" - Run pre-commit:
pre-commit run --all-files - If either fails: Fix the issues, then repeat from step 1. Do not stop until both pass.
Rules
- Iterate until clean. Do not report errors and stop—fix them.
- Exclude slow tests during iteration; run full suite once at the end if desired:
uv run pytest
Common Pre-commit Fixes
E501 Line too long
- Never suppress with
# noqa: E501or addE501topyproject.tomlignore list. - Fix: Split the line at a word or operator boundary. For docstrings, wrap to the next line — the
Google format allows multi-line short descriptions. For code, break at
(,,, or+.
C901 / PLR0912 Function too complex / too many branches
- Never suppress with
# noqa: C901,# noqa: PLR0912, or raise the limits inpyproject.toml. - Fix: Extract private helper methods that each own a single concern. If a function exceeds the limit it is doing too many things and must be split.