Orchestrata Ultimate › Gates › ruff

Gate: ruff

At a glance

Purpose Refuse a ruff lint violation in src/, tests/ or scripts/ under [tool.ruff] in pyproject.toml.
Where it runs The scripts/gates.py battery (registered as ruff); CI's lint job (uv run ruff check src/ tests/, .gitlab-ci.yml); deploy/ship.sh verify stage (uv run ruff check src/ tests/ scripts/ claude/); per file inside the commit review (code-review.py's RuffChecker, run by scripts/gate.py review-staged); the pre-commit auto-fix step (ruff check --fix, never blocks).
Trigger A battery run; a CI pipeline; a ship; every git commit that stages .py files.
Exact command Battery argv: uv run ruff check src/ tests/ scripts/
Blocks ruff's own exit code: non-zero on violations, 0 clean. Inside the commit review a ruff finding at ERROR blocks the commit (commit_review.pl: code review blocks at ERROR).
Ruling / ADR None names this gate directly. The commit-review layer is RUL-008; ruff run as <interpreter> -m ruff comes from ADR-0089.
Last recorded verdict ok: true in the primary checkout's .cache/gates.json (file last written 2026-09-22 10:01 local). wt-MAP-PRECOMMIT has no .cache/gates.json.

What it refuses

A ruff lint violation anywhere in src/, tests/, or scripts/ under the [tool.ruff] configuration in pyproject.toml.

Why it exists

Ruff is the standard linter (CLAUDE.md commands: uv run ruff check src/ tests/); its presence in the battery needs no incident. What is recorded is why the battery pairs it with an autoformat pass (scripts/gates.py docstring, self-healing behavior):

"lint: ruff --fix + black run BEFORE the gates. The user-level autoformat hook only fires on Write/Edit tool calls, so any file written by a script (heredoc, codemod, generator) skipped it and failed the lint gate later."

So the battery's autoformat() runs uv run ruff check --fix -q src/ tests/ scripts/ and uv run black -q src/ tests/ scripts/ first (skippable with --no-fix), and the gate then verifies what remains.

How it runs

The two commit-time ruff layers

Typical failures and how to fix them

Wiring