Skip to content

Commit f2777f1

Browse files
physicsrobclaude
andcommitted
CLAUDE.md: linting and formatting section (ruff + mypy contract)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 46d6df0 commit f2777f1

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ flexibility, flag it. Minimizing complexity in the explanation doesn't
6262
reduce the complexity of the mechanism — it just hides it, and the
6363
user will find it later in a more frustrating way.
6464

65+
# Linting and formatting
66+
67+
Format: `uv run ruff format .` Lint: `uv run ruff check .` Types:
68+
`uv run mypy .` All three (via `make lint`) must pass before
69+
considering any task complete.
70+
71+
- Never add `# noqa` or `# type: ignore` comments, and never edit the
72+
ruff/mypy configuration to weaken rules. Fix the code instead. If
73+
a rule seems genuinely wrong for this codebase, stop and ask — the
74+
ignore list in `pyproject.toml` is a set of deliberate decisions,
75+
each with a recorded reason, not a backlog.
76+
- Use modern typing syntax: `X | None` not `Optional[X]`, `X | Y` not
77+
`Union[X, Y]`, `dict/list/tuple` not `Dict/List/Tuple` (enforced via
78+
UP006/UP007/UP045).
79+
- ruff is pinned exactly in the dev group because `select = ["ALL"]`
80+
picks up new rules on upgrade; bumping the pin and fixing the new
81+
findings is one deliberate act.
82+
- The generated noise footers in `torchwright/ops/` docstrings (below
83+
each `.. noise-footer::` marker) are exempt from manual edits of any
84+
kind — including lint fixes. Fix the generator instead (see
85+
*Numerical noise*).
86+
6587
# Testing
6688

6789
## Running Tests

0 commit comments

Comments
 (0)