Gate lint and formatting in CI - #42
Merged
Merged
Conversation
Ruff is configured but has never been run as a formatter, so every file carries whatever shape it was written in. The cost is not the shape — it is that anyone who runs `ruff format` while editing one file reformats two dozen others along with it, and the real change disappears into the noise. That happened while writing the last few changes here. Formatting everything once makes the next run a no-op, so a diff stays about what its author actually did. Mechanical only. Every file was parsed before and after and compared as an AST: all 64 are identical, so nothing here can change behavior. One pre-existing lint error came along — a stray blank line in the script directory's import block, which had never been linted because ruff was only ever pointed at the backend. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Formatting the tree only helps until the next person edits without running the formatter, and then the one after that reformats everything inside an unrelated change. A check is what makes the previous commit hold. CI grows a job running `ruff check` and `ruff format --check`, and the Makefile grows `lint` (what CI runs) and `format` (the fixer), so the command that fails in CI is the same one available locally. Both cover scripts/ and api/ as well as the backend. Ruff was only ever pointed at backend/, which is exactly why the script directory had a lint error nobody had seen. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the CI gate that makes #41 stick.
Formatting the tree only helps until the next person edits without running the formatter — and then the one after that reformats everything inside an unrelated change, which is the problem #41 set out to end. A check is what makes it hold.
Stacked on #41. Its base is
claude/ruff-format-baseline, so the diff here is just the gate. Merge #41 first; GitHub will retarget this tomainautomatically. Merging this against an unformattedmainwould fail CI on the first run, which is the point.Type of Change
Details
A
python-lintjob runsruff checkandruff format --check. It is its own job rather than two more steps on the backend one, so a formatting failure reads as a formatting failure instead of "Backend tests failed".make lintruns exactly what CI runs, andmake formatis the fixer for what it reports — so the command that fails in CI is the same one available locally, and the fix is one target away rather than a flag someone has to remember.Both cover
scripts/andapi/alongside the backend. Ruff was only ever pointed atbackend/, which is precisely why the script directory carried a lint error nobody had seen until #41.Privacy Checklist
Testing
make lintpasses on the tree as of #41 (All checks passed!,64 files already formatted),make test(143 passed), and the workflow YAML parses with the expected four jobs and step list.A gate is only worth having if it fails, so I checked that too: appending a deliberately misformatted function to a backend file made
make lintexit non-zero and name the file, and reverting it returned to clean. Verified in the direction that matters, not just the passing one.Screenshots
n/a.
Related Issue
Depends on
#41.