feat: standardize ruff config to platform standard #214
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api!214
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "212-standardize-ruff-config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Aligns basketball-api ruff config to the platform standard (line-length=88, select=E,F,I,W). Drops N (naming) lint rules per platform convention, adds E501 to ignore list since ruff format handles line length for code structure (E501 on strings/comments is noise per ruff docs), and adds a ruff pre-commit hook.
Changes
pyproject.toml-- line-length 100->88, select drops N, adds ignore=["E501"].pre-commit-config.yaml-- new file, ruff lint + format hooks (v0.15.2)ruff formatto new 88-char line lengthTest Plan
ruff check .-- zero violationsruff format --check .-- all 82 files formattedpython -m pytest tests/ -x -q-- 614 passed, zero failuresReview Checklist
Related Notes
PR #214 Review
DOMAIN REVIEW
Tech stack: Python 3.12 / FastAPI / SQLAlchemy / Pydantic / Ruff / Woodpecker CI
This PR standardizes the ruff configuration from
line-length=100withN(naming) rules toline-length=88withselect=["E", "F", "I", "W"], aligning basketball-api with the platform standard (verified againstpal-e-docs/pyproject.tomlwhich uses the identical config).pyproject.toml changes reviewed:
line-length = 88-- PEP 8 standard, matches Black/ruff default. Correct.select = ["E", "F", "I", "W"]-- pycodestyle errors, pyflakes, isort, pycodestyle warnings. Matches platform standard.ignore = ["E501"]-- Correct.ruff formathandles line wrapping, so the E501 lint rule is redundant. This prevents false positives on string literals and comments thatruff formatintentionally does not split.extend-exclude = ["alembic/versions"]-- Correct. Auto-generated migrations should not be reformatted.target-version = "py312"-- Matches therequires-python = ">=3.12"and thepython:3.12-slimin Dockerfile/CI. Correct.Dropping N (naming convention) rules: The N rules (pep8-naming) were removed. This is appropriate for this codebase -- the code already follows standard Python naming conventions organically, and N rules can generate false positives on SQLAlchemy model fields and Pydantic schemas that use PascalCase class names with snake_case fields (standard practice). No naming regressions observed in the reviewed files.
Reformatted source files reviewed (sampling across src, tests, services, routes):
src/basketball_api/main.py-- Pure formatting, no logic changes.src/basketball_api/auth.py-- Auth logic intact. Line wrapping changes only.src/basketball_api/config.py-- Config unchanged (already under 88 chars).src/basketball_api/models.py-- ORM definitions intact. Multi-line wrapping at 88 chars.src/basketball_api/database.py-- Unchanged (already compact).src/basketball_api/brand.py-- CSS string constants preserved (ruff format correctly does not split string literals).src/basketball_api/routes/admin.py-- All route logic, Pydantic schemas, and auth dependencies intact.src/basketball_api/routes/public.py-- Public endpoint logic and validation unchanged.src/basketball_api/services/keycloak.py-- Keycloak admin API calls intact.src/basketball_api/services/registration.py-- Checkout processing logic intact.src/basketball_api/services/email.py-- Email service logic intact.src/basketball_api/logging_config.py-- Structured logging middleware intact.tests/conftest.py-- Test fixtures intact.noqa: E402comments preserved.tests/test_public.py-- All test assertions and fixtures intact.alembic/env.py-- Migration env intact.CI pipeline (
/.woodpecker.yaml): The pipeline runsruff check .andruff format --check .beforepytest. This means CI will validate both lint compliance and format compliance against the new 88-char config. No CI changes needed -- ruff reads frompyproject.tomlautomatically.BLOCKERS
None.
This is a formatting-only change with no new functionality, no logic changes, and no security surface changes. The BLOCKER criteria do not apply:
NITS
Consider adding
ruff formattarget-version: The[tool.ruff]section hastarget-version = "py312"which applies to lint rules.ruff formatalso respects this, so no issue, but documenting this in a comment could aid future maintainers.brand.pyline 20:FONT_FAMILYstring is ~95 chars. This is fine --ruff formatcorrectly does not split string literals, andE501is ignored. Just noting for awareness that some lines will legitimately exceed 88 chars.SOP COMPLIANCE
212-standardize-ruff-configreferences issue #212)feat: standardize ruff config to platform standard).envfiles, config defaults are empty strings,.gitignorecovers.env*)PROCESS OBSERVATIONS
ruff check . && ruff format --check . && pytest) gates both format compliance and test correctness. If all 144 tests pass with the new formatting, there is no regression risk.VERDICT: APPROVED