feat: standardize ruff config to line-length=88, select=E,F,I,W #10

Merged
forgejo_admin merged 1 commit from 9-standardize-ruff-config into main 2026-03-28 19:05:05 +00:00

Summary

Aligns minio-api to the platform-wide ruff standard: line-length=88 (ruff/Black default) with lint rules E,F,I,W only. Adds a .pre-commit-config.yaml with ruff hooks for local enforcement.

Changes

  • pyproject.toml -- changed line-length from 120 to 88 (select was already correct)
  • .pre-commit-config.yaml -- new file with ruff (lint + fix) and ruff-format hooks pinned to v0.15.2
  • src/minio_api/main.py -- reformatted + wrapped long error message string
  • src/minio_api/dependencies.py -- reformatted
  • src/minio_api/permissions.py -- reformatted
  • src/minio_api/schemas.py -- reformatted
  • src/minio_api/routes/buckets.py -- reformatted
  • src/minio_api/routes/objects.py -- reformatted + wrapped long string literals (Content-Disposition, 413 detail)
  • src/minio_api/routes/presign.py -- reformatted
  • src/minio_api/routes/multipart.py -- reformatted
  • tests/test_auth.py -- reformatted
  • tests/test_auth_middleware.py -- reformatted + shortened docstrings exceeding 88 chars
  • tests/test_buckets.py -- reformatted
  • tests/test_objects.py -- reformatted
  • tests/test_multipart.py -- reformatted
  • tests/test_permissions.py -- reformatted

Test Plan

  • ruff check . -- zero violations
  • ruff format --check . -- all 20 files formatted
  • pytest unit tests -- 63/63 passed (auth, auth_middleware, permissions)
  • Integration tests (buckets, objects, presign, multipart) require live MinIO -- skipped as expected

Review Checklist

  • Passed automated review-fix loop
  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #9
  • Parent: forgejo_admin/pal-e-platform#29
  • Project: pal-e-platform
## Summary Aligns minio-api to the platform-wide ruff standard: line-length=88 (ruff/Black default) with lint rules E,F,I,W only. Adds a `.pre-commit-config.yaml` with ruff hooks for local enforcement. ## Changes - `pyproject.toml` -- changed `line-length` from 120 to 88 (select was already correct) - `.pre-commit-config.yaml` -- new file with `ruff` (lint + fix) and `ruff-format` hooks pinned to v0.15.2 - `src/minio_api/main.py` -- reformatted + wrapped long error message string - `src/minio_api/dependencies.py` -- reformatted - `src/minio_api/permissions.py` -- reformatted - `src/minio_api/schemas.py` -- reformatted - `src/minio_api/routes/buckets.py` -- reformatted - `src/minio_api/routes/objects.py` -- reformatted + wrapped long string literals (Content-Disposition, 413 detail) - `src/minio_api/routes/presign.py` -- reformatted - `src/minio_api/routes/multipart.py` -- reformatted - `tests/test_auth.py` -- reformatted - `tests/test_auth_middleware.py` -- reformatted + shortened docstrings exceeding 88 chars - `tests/test_buckets.py` -- reformatted - `tests/test_objects.py` -- reformatted - `tests/test_multipart.py` -- reformatted - `tests/test_permissions.py` -- reformatted ## Test Plan - [x] `ruff check .` -- zero violations - [x] `ruff format --check .` -- all 20 files formatted - [x] `pytest` unit tests -- 63/63 passed (auth, auth_middleware, permissions) - [ ] Integration tests (buckets, objects, presign, multipart) require live MinIO -- skipped as expected ## Review Checklist - [x] Passed automated review-fix loop - [x] No secrets committed - [x] No unnecessary file changes - [x] Commit messages are descriptive ## Related Notes - Closes #9 - Parent: `forgejo_admin/pal-e-platform#29` - Project: `pal-e-platform`
Aligns minio-api to the platform-wide ruff standard. Narrows line
length from 120 to 88, adds .pre-commit-config.yaml with ruff hooks,
and reformats all source files to pass clean.

Closes #9

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

QA Review

Config (pyproject.toml): line-length correctly changed 120 -> 88. select was already ["E", "F", "W", "I"] -- no change needed. Ruff version pinned at v0.15.2 in both pyproject.toml and pre-commit config. Clean.

Pre-commit (.pre-commit-config.yaml): Both ruff --fix and ruff-format hooks present. Version matches dev dependency. Clean.

Source reformatting (14 files): All changes are mechanical line wrapping from the narrower line length. No logic changes anywhere. The 5 manual E501 fixes are correct:

  • main.py -- error message string split preserves content
  • objects.py -- Content-Disposition uses parenthesized expression (valid Python)
  • objects.py -- 413 detail message split preserves same user-facing string
  • test_auth_middleware.py -- two docstrings shortened without losing meaning

Verification:

  • ruff check . -- zero violations
  • ruff format --check . -- 20/20 files clean
  • pytest -- 63/63 unit tests pass, no regressions
  • Integration tests correctly skipped (require live MinIO)

No issues found. Purely mechanical formatting standardization with no behavioral changes.

VERDICT: APPROVED

## QA Review **Config (pyproject.toml):** `line-length` correctly changed 120 -> 88. `select` was already `["E", "F", "W", "I"]` -- no change needed. Ruff version pinned at `v0.15.2` in both pyproject.toml and pre-commit config. Clean. **Pre-commit (.pre-commit-config.yaml):** Both `ruff --fix` and `ruff-format` hooks present. Version matches dev dependency. Clean. **Source reformatting (14 files):** All changes are mechanical line wrapping from the narrower line length. No logic changes anywhere. The 5 manual E501 fixes are correct: - `main.py` -- error message string split preserves content - `objects.py` -- Content-Disposition uses parenthesized expression (valid Python) - `objects.py` -- 413 detail message split preserves same user-facing string - `test_auth_middleware.py` -- two docstrings shortened without losing meaning **Verification:** - `ruff check .` -- zero violations - `ruff format --check .` -- 20/20 files clean - `pytest` -- 63/63 unit tests pass, no regressions - Integration tests correctly skipped (require live MinIO) **No issues found.** Purely mechanical formatting standardization with no behavioral changes. VERDICT: APPROVED
Author
Owner

PR #10 Review

DOMAIN REVIEW

Tech stack: Python / FastAPI / Pydantic / ruff / pre-commit

This PR is a formatting-only change: line-length reduced from 120 to 88, with ruff auto-format applied across 16 files plus a new .pre-commit-config.yaml for local enforcement.

Ruff config (pyproject.toml)

  • line-length = 88 -- correct (ruff/Black default, platform convention).
  • select = ["E", "F", "W", "I"] -- correct (platform convention). Was already set; no change needed.
  • target-version = "py312" -- correct.

Pre-commit config (.pre-commit-config.yaml)

  • rev: v0.15.2 matches ruff==0.15.2 pinned in [project.optional-dependencies] dev. Version sync is correct.
  • Hook order is correct: ruff (lint + fix) runs before ruff-format.

Formatting verification

  • Searched all src/ and tests/ files for lines exceeding 88 characters: zero matches. The formatter was applied completely.
  • Files not in the diff (auth.py, conftest.py, test_presign.py, __init__.py files, routes/__init__.py) were already within 88-char limits. No missed files.

Behavioral integrity

  • All changes are line wrapping, import grouping, and parenthesization. No logic changes.
  • Two test docstrings in test_auth_middleware.py were shortened to fit within 88 chars (lines 157, 200 in the new file). These are fixture/test method docstrings -- purely descriptive, no behavioral impact.
  • Error message string in objects.py (413 detail) was split across two f-string literals using implicit concatenation. The runtime string is semantically identical.
  • Content-Disposition header value in objects.py wrapped with parentheses -- identical runtime value.

BLOCKERS

None.

This is a pure formatting/tooling PR. No new functionality, so the "new functionality must have tests" criterion does not apply. No user input handling changes. No secrets. No auth logic changes.

NITS

  1. Pre-commit not in CI yet: The .pre-commit-config.yaml enforces formatting locally but the Woodpecker pipeline (issue #8, still open) would be the place to add ruff check . && ruff format --check . as a CI gate. Not a blocker for this PR -- just noting the enforcement gap until CI is wired.

SOP COMPLIANCE

  • Branch named after issue (9-standardize-ruff-config references issue #9)
  • PR body has Summary, Changes, Test Plan, Related
  • Related section references parent (forgejo_admin/pal-e-platform#29)
  • Closes #9 declared
  • No secrets committed
  • No .env files committed
  • No unnecessary file changes (all 16 files are formatting-only, scoped to the ruff config change)
  • Commit messages are descriptive

Minor template note: PR body uses "Review Checklist" and "Related Notes" instead of the standard "Related" section heading. Non-blocking.

PROCESS OBSERVATIONS

  • Clean formatting standardization. Low change-failure risk -- no logic changes, tests reported passing (63/63 unit, integration skipped as expected).
  • This unblocks consistent formatting across the minio-api codebase. The pre-commit config means future contributors get local enforcement immediately.
  • The CI pipeline (issue #8) should add ruff as a gate step to close the enforcement loop.

VERDICT: APPROVED

## PR #10 Review ### DOMAIN REVIEW **Tech stack**: Python / FastAPI / Pydantic / ruff / pre-commit This PR is a **formatting-only** change: line-length reduced from 120 to 88, with ruff auto-format applied across 16 files plus a new `.pre-commit-config.yaml` for local enforcement. **Ruff config (`pyproject.toml`)** - `line-length = 88` -- correct (ruff/Black default, platform convention). - `select = ["E", "F", "W", "I"]` -- correct (platform convention). Was already set; no change needed. - `target-version = "py312"` -- correct. **Pre-commit config (`.pre-commit-config.yaml`)** - `rev: v0.15.2` matches `ruff==0.15.2` pinned in `[project.optional-dependencies] dev`. Version sync is correct. - Hook order is correct: `ruff` (lint + fix) runs before `ruff-format`. **Formatting verification** - Searched all `src/` and `tests/` files for lines exceeding 88 characters: **zero matches**. The formatter was applied completely. - Files not in the diff (`auth.py`, `conftest.py`, `test_presign.py`, `__init__.py` files, `routes/__init__.py`) were already within 88-char limits. No missed files. **Behavioral integrity** - All changes are line wrapping, import grouping, and parenthesization. No logic changes. - Two test docstrings in `test_auth_middleware.py` were shortened to fit within 88 chars (lines 157, 200 in the new file). These are fixture/test method docstrings -- purely descriptive, no behavioral impact. - Error message string in `objects.py` (413 detail) was split across two f-string literals using implicit concatenation. The runtime string is semantically identical. - `Content-Disposition` header value in `objects.py` wrapped with parentheses -- identical runtime value. ### BLOCKERS None. This is a pure formatting/tooling PR. No new functionality, so the "new functionality must have tests" criterion does not apply. No user input handling changes. No secrets. No auth logic changes. ### NITS 1. **Pre-commit not in CI yet**: The `.pre-commit-config.yaml` enforces formatting locally but the Woodpecker pipeline (issue #8, still open) would be the place to add `ruff check . && ruff format --check .` as a CI gate. Not a blocker for this PR -- just noting the enforcement gap until CI is wired. ### SOP COMPLIANCE - [x] Branch named after issue (`9-standardize-ruff-config` references issue #9) - [x] PR body has Summary, Changes, Test Plan, Related - [x] Related section references parent (`forgejo_admin/pal-e-platform#29`) - [x] Closes #9 declared - [x] No secrets committed - [x] No .env files committed - [x] No unnecessary file changes (all 16 files are formatting-only, scoped to the ruff config change) - [x] Commit messages are descriptive **Minor template note**: PR body uses "Review Checklist" and "Related Notes" instead of the standard "Related" section heading. Non-blocking. ### PROCESS OBSERVATIONS - Clean formatting standardization. Low change-failure risk -- no logic changes, tests reported passing (63/63 unit, integration skipped as expected). - This unblocks consistent formatting across the minio-api codebase. The pre-commit config means future contributors get local enforcement immediately. - The CI pipeline (issue #8) should add ruff as a gate step to close the enforcement loop. ### VERDICT: APPROVED
forgejo_admin deleted branch 9-standardize-ruff-config 2026-03-28 19:05:05 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/minio-api!10
No description provided.