chore(ruff): adopt expanded lint rules and format config from median#34
Merged
Conversation
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>
Codecov Report❌ Patch coverage is
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]— selectN(pep8-naming),UP(pyupgrade),B(bugbear),SIM(simplify), andRUFon top of the existingE/W/F/I; ignoreE501(the formatter handles line length).[tool.ruff.format]— explicitquote-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-versionstayspy310(median ispy311). jamb'srequires-pythonis>=3.10; copyingpy311would letpyupgraderewrite code with 3.11-only syntax and break 3.10 support.line-lengthstays120(median is88) — keeping it avoids reformatting the entire codebase in this change.craniotrace/tissunet/clinsegper-file-ignores are not relevant to jamb and were not copied.Code fixes
The new rules surfaced 223 violations, all resolved:
pyupgrademodernizations,contextlib.suppress, ternaries,next(iter(...)), sorted__all__, etc.RUF002— EN DASH (–) in docstrings (almost all intest_comprehensive.pytitles) replaced with ASCII hyphens.with/ifstatements, lowercased in-function constants (e.g. DFSWHITE/GRAY/BLACK→white/gray/black), and escaped/raw-stringed regex metacharacters inpytest.raises(match=...).Behavior is unchanged: ruff check, ruff format,
ty, and the full test suite (1478 passed, 1 skipped) are all green.🤖 Generated with Claude Code