Skip to content

chore(ruff): adopt expanded lint rules and format config from median#34

Merged
vanandrew merged 1 commit into
mainfrom
chore/ruff-settings
Jun 16, 2026
Merged

chore(ruff): adopt expanded lint rules and format config from median#34
vanandrew merged 1 commit into
mainfrom
chore/ruff-settings

Conversation

@vanandrew

Copy link
Copy Markdown
Owner

Summary

Aligns jamb's ruff configuration with the median project's, which uses a curated lint rule set instead of jamb's defaults-only config.

Config changes (pyproject.toml)

  • [tool.ruff.lint] — select N (pep8-naming), UP (pyupgrade), B (bugbear), SIM (simplify), and RUF on top of the existing E/W/F/I; ignore E501 (the formatter handles line length).
  • [tool.ruff.format] — explicit quote-style = "double", indent-style = "space", docstring-code-format = true.

Adapted, not copied verbatim

These median values are project-specific, so I kept jamb's:

  • target-version stays py310 (median is py311). jamb's requires-python is >=3.10; copying py311 would let pyupgrade rewrite code with 3.11-only syntax and break 3.10 support.
  • line-length stays 120 (median is 88) — keeping it avoids reformatting the entire codebase in this change.
  • median's craniotrace/tissunet/clinseg per-file-ignores are not relevant to jamb and were not copied.

Code fixes

The new rules surfaced 223 violations, all resolved:

  • Auto-fixed (safe + unsafe): import sorting, pyupgrade modernizations, contextlib.suppress, ternaries, next(iter(...)), sorted __all__, etc.
  • 143 RUF002 — EN DASH () in docstrings (almost all in test_comprehensive.py titles) replaced with ASCII hyphens.
  • Manual — combined nested with/if statements, lowercased in-function constants (e.g. DFS WHITE/GRAY/BLACKwhite/gray/black), and escaped/raw-stringed regex metacharacters in pytest.raises(match=...).

Behavior is unchanged: ruff check, ruff format, ty, and the full test suite (1478 passed, 1 skipped) are all green.

Merge note: this branch is off main and lightly edits src/jamb/publish/formats/docx.py and html.py, which PR #33 (Quarto publishing) deletes. Whichever PR merges second will hit a trivial modify/delete conflict on those two files — resolve by taking the deletion.

🤖 Generated with Claude Code

Bring jamb's ruff configuration in line with the median project's: select
pep8-naming (N), pyupgrade (UP), flake8-bugbear (B), flake8-simplify (SIM),
and Ruff-specific (RUF) rules on top of the existing defaults, ignore E501
(handled by the formatter), and add an explicit [tool.ruff.format] block
(double quotes, space indent, docstring code formatting).

Project-specific values are kept rather than copied verbatim: target-version
stays py310 (jamb supports 3.10; py311 would let pyupgrade emit 3.11-only
syntax) and line-length stays 120. median's package-specific per-file-ignores
are not applicable and were not copied.

Resolves all 223 violations the new rules surface (auto-fixes plus manual
fixes for nested with/if collapsing, in-function constant casing, regex
escaping in pytest.raises match=, and contextlib.suppress). Behavior is
unchanged; the full suite passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vanandrew vanandrew merged commit 9d6b03d into main Jun 16, 2026
7 checks passed
@vanandrew vanandrew deleted the chore/ruff-settings branch June 16, 2026 05:21
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.84%. Comparing base (46e198e) to head (759a3de).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/jamb/cli/commands.py 90.47% 0 Missing and 2 partials ⚠️
src/jamb/storage/test_references.py 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   91.80%   91.84%   +0.04%     
==========================================
  Files          27       27              
  Lines        3880     3852      -28     
  Branches      886      867      -19     
==========================================
- Hits         3562     3538      -24     
  Misses        198      198              
+ Partials      120      116       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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