lint: pin ruff to the essential ruleset (fixes pre-existing red CI) - #93
Merged
Conversation
CI runs ruff 0.16.1 (resolving `ruff>=0.15.9`), whose *default* select is broad — I/UP/B/SIM/PLR/RUF (import-sorting, type-annotation modernization, etc.) — so it flagged ~34 style issues across the repo. These were never a deliberate choice: `[tool.ruff]` only ever set `exclude`, never `select`, so the effective ruleset was whatever the installed ruff defaulted to (and it drifted broad as ruff updated). Local dev with an older ruff (0.9.9) never saw them. Fix, without churning core code: - pyproject: add `[tool.ruff.lint] select = ["E4","E7","E9","F"]` — pin to the classic essentials (pycodestyle errors + pyflakes real-bug checks), version- stable, dropping the style/modernization families. `ruff check .` now clean. - ruff format: 6 files were never formatted — 3 docs' code blocks + the 3 mlx tests — so ran `ruff format`. Docs/tests only, no library code. - 2 `# noqa: E402` in test_mlx_pre_encode.py: imports intentionally deferred after `pytest.importorskip(...)` / `sys.path.insert(...)`. Both `ruff check` and `ruff format --check` pass under 0.16.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cortexelus
force-pushed
the
fix-ruff-mlx-test-lint
branch
from
August 2, 2026 09:10
57b56a8 to
e9959f8
Compare
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.
CI's Lint workflow (
ruff check+ruff format --check) has been red since the repo's initial commit, and it's been skipped becausemainisn't branch-protected.Root cause
[tool.ruff]only ever setexclude— never aselect— so ruff runs whatever ruleset its installed version defaults to. CI resolvesruff>=0.15.9to 0.16.1, whose default is broad (Iisort,UPpyupgrade,B,SIM,PLR,RUF), flagging ~34 style/modernization issues across core files, docs, and tests. (Local dev with an older ruff has a narrow default, so it never surfaced.) No config change ever "turned these on" — the default just drifted broad as ruff updated.Fix (no core-code churn)
pyproject.toml: add[tool.ruff.lint] select = ["E4","E7","E9","F"]— pin to the classic essentials (pycodestyle errors + pyflakes real-bug checks: undefined names, unused imports/vars). Version-stable; drops the style/modernization families. →ruff check .clean.ruff format: 6 files were never formatted — 3 docs' code blocks + the 3 mlx tests. Ran the formatter. Docs/tests only, no library code.# noqa: E402intest_mlx_pre_encode.py: imports intentionally deferred afterpytest.importorskip(...)/sys.path.insert(...).Both
ruff checkandruff format --checkpass under 0.16.1. No behavior change.🤖 Generated with Claude Code