Skip to content

refactor(backend): fix remaining ruff findings and enforce full ruff check - #113

Merged
klin2686 merged 8 commits into
mainfrom
refactor/backend-lint-fixes
Oct 13, 2026
Merged

klin2686 merged 8 commits into
mainfrom
refactor/backend-lint-fixes

Conversation

@klin2686

Copy link
Copy Markdown
Collaborator

Summary

Clears the 163 Ruff findings left after #112 and turns on the full ruff check in CI and the pre-commit hook, so the backend stays at zero findings.

No API behavior changes; the /join/ OpenAPI spec is identical to main.

What changed

Backend

Logic

  • B008: the require_* permission dependencies are marked safe in defaults (77 false positives).
  • B008: # noqa on POST /join/'s JoinRedeemRequest() default; FastAPI deep-copies body defaults per request, so it is never shared.
  • B904: 52 re-raises inside except blocks now chain with from e, or from None where the error was already discarded (mostly IntegrityError → 409).
  • Clients see no change from chaining: HTTPException only serializes detail, and the app has no debug mode or custom handlers.
  • B905: zip(..., strict=True) on 7 pairings that must line up (roster rows with their responses, staff-invite results with their inputs).
  • B905: the shift-overlap check uses itertools.pairwise; sheets_service uses an explicit strict=False, keeping its current dropping of cells past the header row.
  • B023: collect_active_field_errors builds its per-field checks with functools.partial instead of lambdas.
  • Removes the unused type_changed in forms.py, unused imports, and the unused tournament argument to apply_display_config.
  • get_scoped_or_404 uses [T] generic syntax instead of a module-level TypeVar.

Tests

  • Drops six unused test variables, keeping the calls that create rows.
  • Renames test_get_membership_surface_hides_availability_day to ..._track; availability has been keyed by track since 72dde4c7.

Repo

  • CI runs ruff check . and ruff format --check . before pytest.
  • The pre-commit hook runs the full ruff check --fix, then formats, and blocks on anything that can't be fixed automatically.
  • CONTRIBUTING lists the updated manual commands.

Out of scope

  • Comment cleanup and moving models.py to Mapped[] style.

Test plan

  • pytest passes locally

Automated

  • ruff check . and ruff format --check . pass with zero findings.
  • Ran the test files covering each change, all passing: memberships, display config, forms and form validation, events, zones, join, tracks, buildings, tournament and chapter core, and the email, sheets, forms and sync services.
  • Every app module imports, and the migrations compile.

Manual

  • Compared the /join/ OpenAPI schema with main: identical.
  • Ran the pre-commit hook in five staging states; it fixes what it safely can and blocks unfixable lint errors and unformatted partly staged files.

@railway-app

railway-app Bot commented Oct 13, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @klin2686 does not have access to the Railway project.

In order to get automatic PR deploys, please add @klin2686 to your workspace on Railway.

@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nexus Ready Ready Preview Oct 13, 2026 9:21am UTC

@klin2686
klin2686 merged commit ab7754f into main Oct 13, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 534229a6 Deployed Oct 13, 2026 by vercel[bot]
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