Skip to content

lint: pin ruff to the essential ruleset (fixes pre-existing red CI) - #93

Merged
Cortexelus merged 1 commit into
mainfrom
fix-ruff-mlx-test-lint
Aug 2, 2026
Merged

lint: pin ruff to the essential ruleset (fixes pre-existing red CI)#93
Cortexelus merged 1 commit into
mainfrom
fix-ruff-mlx-test-lint

Conversation

@Cortexelus

@Cortexelus Cortexelus commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

CI's Lint workflow (ruff check + ruff format --check) has been red since the repo's initial commit, and it's been skipped because main isn't branch-protected.

Root cause

[tool.ruff] only ever set excludenever a select — so ruff runs whatever ruleset its installed version defaults to. CI resolves ruff>=0.15.9 to 0.16.1, whose default is broad (I isort, UP pyupgrade, 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.
  • 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. No behavior change.

🤖 Generated with Claude Code

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
Cortexelus force-pushed the fix-ruff-mlx-test-lint branch from 57b56a8 to e9959f8 Compare August 2, 2026 09:10
@Cortexelus Cortexelus changed the title tests: fix pre-existing ruff lint (format + E402 in the mlx tests) lint: pin ruff to the essential ruleset (fixes pre-existing red CI) Aug 2, 2026
@Cortexelus
Cortexelus merged commit a0b57f5 into main Aug 2, 2026
1 check passed
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