style: apply tree-wide ruff format and enforce it in CI (#20) #161

Merged
claude-bot merged 1 commit from chore/20-ruff-format-tree into main 2026-07-15 22:59:14 +00:00
Contributor

Summary

CI ran ruff check (lint) but never ruff format --check, so the backend tree had never been uniformly formatted. This reformats it with the pinned ruff version and adds the format gate.

Changes

  • Reformat webapp/backend/ with ruff 0.4.4 (the version in .pre-commit-config.yaml / CI): 108 files reformatted, behaviour unchanged.
  • CI: add a ruff format --check webapp/backend/ step to the lint-backend job.
  • Latent bug fixed: wrapping the unlinked_member relationship moved its # noqa: F821 off the forward-ref line, so the suppression stopped applying and ruff check failed. Repositioned the noqa onto the annotation line — format + check both clean and stable.
  • requirements-dev.txt: pin ruff back to 0.4.4 to match the hook and CI (ruff format output is version-sensitive — all three must agree; requirements-dev had drifted to 0.15.21). Drop black (unused; ruff format is the single formatter now).
  • renovate.json: hold ruff (requirements + pre-commit) at its pin so it can't drift and silently break the format gate.

Note on ruff version

The issue specified 0.4.4, matching the pre-commit hook and the CI ruff check. requirements-dev.txt had separately drifted to 0.15.21 (Renovate) — reconciled back to 0.4.4 here so the formatter is identical everywhere. A deliberate ruff upgrade (bumping the hook + reformatting together) can be a separate change.

Verification

  • ruff format --check webapp/backend/ → clean (160 files).
  • ruff check webapp/backend/ → All checks passed.
  • Full backend suite runs in CI on this PR (formatting is behaviour-preserving).

Closes #20

🤖 Generated with Claude Code

## Summary CI ran `ruff check` (lint) but never `ruff format --check`, so the backend tree had never been uniformly formatted. This reformats it with the pinned ruff version and adds the format gate. ## Changes - **Reformat** `webapp/backend/` with **ruff 0.4.4** (the version in `.pre-commit-config.yaml` / CI): **108 files reformatted, behaviour unchanged**. - **CI**: add a `ruff format --check webapp/backend/` step to the `lint-backend` job. - **Latent bug fixed:** wrapping the `unlinked_member` relationship moved its `# noqa: F821` off the forward-ref line, so the suppression stopped applying and `ruff check` failed. Repositioned the noqa onto the annotation line — format + check both clean and stable. - **`requirements-dev.txt`**: pin ruff back to `0.4.4` to match the hook and CI (ruff format output is version-sensitive — all three must agree; `requirements-dev` had drifted to 0.15.21). Drop `black` (unused; `ruff format` is the single formatter now). - **`renovate.json`**: hold ruff (requirements + pre-commit) at its pin so it can't drift and silently break the format gate. ## Note on ruff version The issue specified 0.4.4, matching the pre-commit hook and the CI `ruff check`. `requirements-dev.txt` had separately drifted to 0.15.21 (Renovate) — reconciled back to 0.4.4 here so the formatter is identical everywhere. A deliberate ruff upgrade (bumping the hook + reformatting together) can be a separate change. ## Verification - `ruff format --check webapp/backend/` → clean (160 files). - `ruff check webapp/backend/` → All checks passed. - Full backend suite runs in CI on this PR (formatting is behaviour-preserving). Closes #20 🤖 Generated with [Claude Code](https://claude.com/claude-code)
style: apply tree-wide ruff format and enforce it in CI (#20)
All checks were successful
CI / Frontend tests, audit, and build (pull_request) Successful in 1m29s
CI / Backend lint (ruff) (pull_request) Successful in 2m45s
CI / Backend migration, tests, and audit (pull_request) Successful in 3m57s
CI / Docker image build (pull_request) Successful in 4m19s
CI / Bot tests and audit (pull_request) Successful in 5m47s
d62734283f
CI ran `ruff check` (lint) but not `ruff format --check`, so the tree
had never been uniformly formatted. Reformat webapp/backend/ with ruff
0.4.4 (the version pinned in .pre-commit-config.yaml) and add the format
gate to CI.

- Run `ruff format webapp/backend/` — 108 files reformatted, behaviour
  unchanged.
- .forgejo/workflows/ci.yml: add a `ruff format --check` step to the
  lint-backend job.
- Fix one format-exposed latent bug: wrapping the `unlinked_member`
  relationship moved its `# noqa: F821` off the forward-ref line, so the
  suppression stopped applying. Reposition the noqa onto the annotation
  line so `ruff check` stays clean.
- requirements-dev.txt: pin ruff back to 0.4.4 to match the hook and CI
  (ruff format output is version-sensitive; all three must agree) and
  drop black — ruff format is the single formatter now.
- renovate.json: hold ruff (requirements + pre-commit) at its pinned
  version so it can't drift and silently break the format gate.

Closes #20

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
claude-bot scheduled this pull request to auto merge when all checks succeed 2026-07-15 22:53:40 +00:00
claude-bot deleted branch chore/20-ruff-format-tree 2026-07-15 22:59:15 +00:00
Sign in to join this conversation.
No description provided.