Format the Python tree with ruff, once - #41
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>
10 tasks
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
Runs
ruff formatacross the Python tree once, so that running it again is a no-op.Ruff is configured in
backend/pyproject.tomlbut has never been run as a formatter, so every file carries whatever shape it was written in. The cost isn't the shape — it's that anyone who runsruff formatwhile 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 in this repo, and the collateral had to be reverted by hand.Type of Change
Details
27 of 64 files changed — line wrapping, trailing commas, and blank-line normalization.
backend/app,backend/tests,scripts, andapiare all covered, so no corner is left to drift.One pre-existing lint error came along: a stray blank line in
scripts/export-python-openapi.py's import block, flagged by the already-enabledIrules. It had simply never been caught, becauseruff checkwas only ever pointed atbackend. It is onorigin/maintoday, not something this change introduced.Nothing else is touched: no behavior, no signatures, no imports reordered.
Privacy Checklist
Testing
make test(143 passed),make api-contract-check,ruff checkclean across all four directories, andruff format --checkreports all 64 files already formatted — the point of the exercise.Because a large mechanical diff is exactly the kind nobody can review line by line, the real check is structural: every file was parsed to an AST before and after and the dumps compared. All 64 identical. That is a stronger guarantee than reading the diff, and it is what makes the change safe to take on trust.
Screenshots
n/a.
Related Issue
n/a. A natural follow-up would be gating this in CI (
ruff format --check) so it cannot drift back, which is a separate change since CI runs no lint step today.