Skip to content

Format the Python tree with ruff, once - #41

Merged
ShichengRao merged 1 commit into
mainfrom
claude/ruff-format-baseline
Aug 13, 2026
Merged

ShichengRao merged 1 commit into
mainfrom
claude/ruff-format-baseline

Conversation

@ShichengRao

Copy link
Copy Markdown
Owner

Summary

Runs ruff format across the Python tree once, so that running it again is a no-op.

Ruff is configured in backend/pyproject.toml but 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 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 in this repo, and the collateral had to be reverted by hand.

Type of Change

  • Importer support
  • Bug fix
  • Tests
  • Documentation
  • Frontend
  • Backend
  • Refactor / cleanup

Details

27 of 64 files changed — line wrapping, trailing commas, and blank-line normalization. backend/app, backend/tests, scripts, and api are 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-enabled I rules. It had simply never been caught, because ruff check was only ever pointed at backend. It is on origin/main today, not something this change introduced.

Nothing else is touched: no behavior, no signatures, no imports reordered.

Privacy Checklist

  • I used only synthetic test/sample data.
  • I did not include real account numbers, balances, merchants, names, addresses, or other personal details.
  • This change does not add or expand outbound network access.

Testing

make test (143 passed), make api-contract-check, ruff check clean across all four directories, and ruff format --check reports 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.

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>
@ShichengRao ShichengRao mentioned this pull request Aug 13, 2026
10 tasks
@ShichengRao
ShichengRao merged commit a487172 into main Aug 13, 2026
5 checks passed
@ShichengRao
ShichengRao deleted the claude/ruff-format-baseline branch August 13, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant