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

Merged
forgejo_admin merged 1 commit from 239-standardize-ruff-config into main 2026-03-28 19:08:57 +00:00

Summary

Aligns pal-e-api to the platform-wide ruff standard: line-length=88 (ruff/Black default) and lint rules E,F,I,W only (drops N naming rules). Reformats all files and fixes 53 E501 line-too-long violations in strings, comments, and docstrings.

Changes

  • pyproject.toml -- updated line-length from 100 to 88, removed "N" from lint select
  • src/pal_e_docs/ -- 33 files reformatted by ruff format, plus manual E501 fixes in routes/blocks.py, routes/boards.py, routes/notes.py, routes/projects.py, blocks/parser.py, embedding_worker.py
  • scripts/ -- split long strings in migrate_boards_to_notes.py and migrate_sqlite_to_postgres.py
  • tests/ -- 19 test files with long docstrings and string constants wrapped to 88 chars
  • .pre-commit-config.yaml -- verified ruff hooks already present (no change needed)

Test Plan

  • ruff check . -- zero violations
  • ruff format --check . -- all 60 files formatted
  • pytest tests/ -x -q -- 685 passed, 0 failed

Review Checklist

  • pyproject.toml has line-length = 88 and select = ["E", "F", "I", "W"]
  • ruff check . passes clean
  • ruff format --check . passes clean
  • All 685 tests pass
  • No N (naming) lint rules added
  • Closes #239
  • Parent: pal-e-platform#29
## Summary Aligns pal-e-api to the platform-wide ruff standard: line-length=88 (ruff/Black default) and lint rules E,F,I,W only (drops N naming rules). Reformats all files and fixes 53 E501 line-too-long violations in strings, comments, and docstrings. ## Changes - `pyproject.toml` -- updated `line-length` from 100 to 88, removed `"N"` from lint select - `src/pal_e_docs/` -- 33 files reformatted by `ruff format`, plus manual E501 fixes in routes/blocks.py, routes/boards.py, routes/notes.py, routes/projects.py, blocks/parser.py, embedding_worker.py - `scripts/` -- split long strings in migrate_boards_to_notes.py and migrate_sqlite_to_postgres.py - `tests/` -- 19 test files with long docstrings and string constants wrapped to 88 chars - `.pre-commit-config.yaml` -- verified ruff hooks already present (no change needed) ## Test Plan - `ruff check .` -- zero violations - `ruff format --check .` -- all 60 files formatted - `pytest tests/ -x -q` -- 685 passed, 0 failed ## Review Checklist - [x] pyproject.toml has `line-length = 88` and `select = ["E", "F", "I", "W"]` - [x] `ruff check .` passes clean - [x] `ruff format --check .` passes clean - [x] All 685 tests pass - [x] No N (naming) lint rules added ## Related Notes - Closes #239 - Parent: pal-e-platform#29
Aligns pal-e-api to the platform-wide ruff standard: line-length=88
(ruff/Black default) and lint rules E,F,I,W only (drops N naming rules).
Reformats all files and fixes 53 E501 line-too-long violations in
strings, comments, and docstrings.

Closes #239

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

PR #240 Review

DOMAIN REVIEW

Tech stack: Python / FastAPI / SQLAlchemy / Pydantic (pal-e-api).

This PR is a formatting-only change: pyproject.toml updates line-length from 100 to 88 and removes the N (naming) rule from ruff's select list. All 38 changed files contain exclusively line-wrapping reformats -- no behavioral or logic changes detected.

Ruff config (pyproject.toml):

  • line-length = 88 aligns with Black's default and PEP 8's "strongly recommended" 79-char guideline (88 is the accepted modern standard). Good.
  • select = ["E", "F", "I", "W"] -- removing N (pep8-naming) is a deliberate scope decision per the issue. The remaining ruleset covers pycodestyle errors (E), pyflakes (F), isort (I), and pycodestyle warnings (W). Adequate for a project of this maturity.
  • extend-exclude = ["alembic/versions"] correctly exempts auto-generated migrations. Good.

Formatting changes across 38 files -- spot-checked all source files (auth.py, models.py, schemas.py, main.py, embedding_worker.py, blocks/compiler.py, blocks/parser.py, blocks/sync.py, all 6 route files, both scripts, and representative test files). Every change is one of:

  • Long function signatures split to multi-line
  • SQLAlchemy query chains wrapped at method boundaries
  • f-string error messages split via implicit concatenation
  • Multi-line import formatting
  • Docstring/comment line wraps

No changes to control flow, return values, exception types, query logic, or API contracts.

Test coverage: 685/685 tests pass. Since no new functionality is introduced (formatting-only), no new tests are required. No blocker.

BLOCKERS

None.

NITS

  1. src/pal_e_docs/blocks/parser.py docstring formatting: The reformatted docstring splits inline annotations across continuation lines using # inside a triple-quoted string:

    "block_type": str, # heading | paragraph | table
    # | code | list | mermaid
    

    Since this is inside a docstring (not actual Python comments), the # characters are literal text. The continuation reads like a separate comment line rather than a continuation of the type list. Consider reformatting to keep all types on one line (e.g., shorten to # heading | paragraph | table | code | list | mermaid by abbreviating), or wrap the full list differently. Non-blocking -- purely a readability concern.

  2. tests/test_boards.py docstring split: The test docstring """Sync works correctly even when plan items exist\non the board (backwards compat).""" wraps mid-sentence. Single-line docstrings are preferred per PEP 257 when possible. Consider rewording to fit 88 chars. Non-blocking.

  3. src/pal_e_docs/routes/boards.py comment split: The comment # Do NOT regress open issues -- if manually moved / # to in_progress/qa, leave it splits an important behavioral note across two lines. The original single-line version was more scannable. Non-blocking but worth preserving intent clarity.

SOP COMPLIANCE

  • Branch named after issue (239-standardize-ruff-config references #239)
  • PR body has Summary, Changes, Test Plan (results), Related sections
  • Related references parent (pal-e-platform#29)
  • Tests exist and pass (685/685)
  • No secrets, .env files, or credentials committed
  • No unnecessary file changes (all 38 files are in-scope for a line-length reformat)
  • Single descriptive commit message (feat: standardize ruff config to line-length=88, select=E,F,I,W)

PROCESS OBSERVATIONS

  • Deployment frequency: Formatting-only PR with zero behavioral risk. Safe to merge without staged rollout.
  • Change failure risk: Minimal. The PR is mechanically verifiable (ruff check . + ruff format --check . + full test suite). All three green per PR body.
  • Standardization value: Aligning to line-length=88 across all Python repos reduces cognitive overhead when context-switching between projects. Good platform hygiene.

VERDICT: APPROVED

## PR #240 Review ### DOMAIN REVIEW **Tech stack**: Python / FastAPI / SQLAlchemy / Pydantic (pal-e-api). This PR is a formatting-only change: `pyproject.toml` updates `line-length` from 100 to 88 and removes the `N` (naming) rule from ruff's `select` list. All 38 changed files contain exclusively line-wrapping reformats -- no behavioral or logic changes detected. **Ruff config** (`pyproject.toml`): - `line-length = 88` aligns with Black's default and PEP 8's "strongly recommended" 79-char guideline (88 is the accepted modern standard). Good. - `select = ["E", "F", "I", "W"]` -- removing `N` (pep8-naming) is a deliberate scope decision per the issue. The remaining ruleset covers pycodestyle errors (E), pyflakes (F), isort (I), and pycodestyle warnings (W). Adequate for a project of this maturity. - `extend-exclude = ["alembic/versions"]` correctly exempts auto-generated migrations. Good. **Formatting changes across 38 files** -- spot-checked all source files (`auth.py`, `models.py`, `schemas.py`, `main.py`, `embedding_worker.py`, `blocks/compiler.py`, `blocks/parser.py`, `blocks/sync.py`, all 6 route files, both scripts, and representative test files). Every change is one of: - Long function signatures split to multi-line - SQLAlchemy query chains wrapped at method boundaries - f-string error messages split via implicit concatenation - Multi-line import formatting - Docstring/comment line wraps No changes to control flow, return values, exception types, query logic, or API contracts. **Test coverage**: 685/685 tests pass. Since no new functionality is introduced (formatting-only), no new tests are required. No blocker. ### BLOCKERS None. ### NITS 1. **`src/pal_e_docs/blocks/parser.py` docstring formatting**: The reformatted docstring splits inline annotations across continuation lines using `#` inside a triple-quoted string: ``` "block_type": str, # heading | paragraph | table # | code | list | mermaid ``` Since this is inside a docstring (not actual Python comments), the `#` characters are literal text. The continuation reads like a separate comment line rather than a continuation of the type list. Consider reformatting to keep all types on one line (e.g., shorten to `# heading | paragraph | table | code | list | mermaid` by abbreviating), or wrap the full list differently. Non-blocking -- purely a readability concern. 2. **`tests/test_boards.py` docstring split**: The test docstring `"""Sync works correctly even when plan items exist\non the board (backwards compat)."""` wraps mid-sentence. Single-line docstrings are preferred per PEP 257 when possible. Consider rewording to fit 88 chars. Non-blocking. 3. **`src/pal_e_docs/routes/boards.py` comment split**: The comment `# Do NOT regress open issues -- if manually moved` / `# to in_progress/qa, leave it` splits an important behavioral note across two lines. The original single-line version was more scannable. Non-blocking but worth preserving intent clarity. ### SOP COMPLIANCE - [x] Branch named after issue (`239-standardize-ruff-config` references #239) - [x] PR body has Summary, Changes, Test Plan (results), Related sections - [x] Related references parent (`pal-e-platform#29`) - [x] Tests exist and pass (685/685) - [x] No secrets, .env files, or credentials committed - [x] No unnecessary file changes (all 38 files are in-scope for a line-length reformat) - [x] Single descriptive commit message (`feat: standardize ruff config to line-length=88, select=E,F,I,W`) ### PROCESS OBSERVATIONS - **Deployment frequency**: Formatting-only PR with zero behavioral risk. Safe to merge without staged rollout. - **Change failure risk**: Minimal. The PR is mechanically verifiable (`ruff check .` + `ruff format --check .` + full test suite). All three green per PR body. - **Standardization value**: Aligning to `line-length=88` across all Python repos reduces cognitive overhead when context-switching between projects. Good platform hygiene. ### VERDICT: APPROVED
forgejo_admin deleted branch 239-standardize-ruff-config 2026-03-28 19:08:57 +00:00
Sign in to join this conversation.
No description provided.