Skip to content

build(lint): sort imports with Ruff's isort rules - #948

Open
bencap wants to merge 1 commit into
release-2026.3.3from
maintenance/bencap/sort-imports
Open

bencap wants to merge 1 commit into
release-2026.3.3from
maintenance/bencap/sort-imports

Conversation

@bencap

@bencap bencap commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

The editor's organize-imports on save applies Ruff's import-sorting rules, but bin/check didn't select them, so saving a file reordered its imports and those reorders showed up in unrelated diffs. This adds "I" to [tool.ruff.lint] select so the CLI and CI enforce the same order the editor applies.

  • Rule: select = ["E4", "E7", "E9", "F", "I"] in pyproject.toml.
  • Fixes: Ruff's --fix output only, in 87 files (three are stubs in mypy_stubs/): reorders within import groups and dropped blank lines after imports. No hand edits.

For open branches: after rebasing onto this, run poetry run ruff check --fix to sort any imports the branch added.

Tests

No new tests; it changes no behavior. Ran bin/check (clean) and the PR suite, bin/t tests/ -n 6 -m "not network and not slow": 5,433 passed, 22 skipped. The full suite was run because reordering imports can change module side effects, such as model registration.

Checklist

  • Targets the open patch branch if this is a small, non-breaking change, or the cycle's release-<year>.<n>.0
    branch otherwise; never main
  • API schema change? A matching mavedb-ui PR regenerates src/schema/openapi.d.ts (no schema change)
  • Docs and instruction files touched by this change are updated (none affected)

Saving a file in the editor sorted its imports, but bin/check never checked
import order, so edits picked up reordering unrelated to the change. Selecting
"I" makes the CLI enforce the same order the editor applies.

This commit is the rule change and Ruff's fixes only, in 87 files: reorders
within import groups and dropped blank lines after imports.
@bencap bencap added the app: backend Task implementation touches the backend label Oct 22, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 39865049119

Coverage decreased (-0.06%) to 90.341%

Details

  • Coverage decreased (-0.06%) from the base build.
  • Patch coverage: 35 of 35 lines across 23 files are fully covered (100%).
  • 12 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

12 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
src/mavedb/lib/clinvar/utils.py 6 90.91%
src/mavedb/worker/jobs/external_services/clinvar.py 4 96.97%
src/mavedb/lib/mondo_ols.py 2 96.92%

Coverage Stats

Coverage Status
Relevant Lines: 19184
Covered Lines: 17331
Line Coverage: 90.34%
Coverage Strength: 0.9 hits per line

💛 - Coveralls

@bencap
bencap marked this pull request as ready for review October 23, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: backend Task implementation touches the backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants