Skip to content

[CHORE] Suggest ruff import sorting on changed files - #1516

Merged
henrydingliu merged 3 commits into
casact:mainfrom
Abhayindia:chore/ruff-isort-1498
Oct 31, 2026
Merged

henrydingliu merged 3 commits into
casact:mainfrom
Abhayindia:chore/ruff-isort-1498

Conversation

@Abhayindia

@Abhayindia Abhayindia commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1498.

Following the review, this no longer reformats the repository. It adds the [tool.ruff.lint.isort] settings proposed in the issue, unchanged, to pyproject.toml, and a step to the Ruff workflow that suggests import fixes for the files a pull request changes.

The step runs only on pull requests, takes the Python files and notebooks changed against the base branch, and runs ruff check --select I --diff --exit-zero on them, so the log shows the diff that would sort their imports and the job never fails because of it. The I rule is not added to the selected rules, so ruff check on the whole repository behaves as before. The Ruff job now checks out with fetch-depth: 0 so the base branch is available.

Checked locally: on a file with unsorted imports the command prints the diff and exits 0, on a sorted file it prints nothing and exits 0, and the workflow file parses as YAML. The step itself only runs in CI, so this pull request's own Ruff run is the first real test of it; it will find nothing to report here unless a changed file has unsorted imports.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.8% of exported symbols fully typed (241 / 1524)

Known Ambiguous Unknown Total
Project (head) 241 106 1177 1524

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 340
  • Functions without default param: 0
  • Classes without docstring: 8

Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.36%. Comparing base (5375622) to head (8723349).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1516   +/-   ##
=======================================
  Coverage   94.36%   94.36%           
=======================================
  Files          97       97           
  Lines        6188     6188           
  Branches      798      798           
=======================================
  Hits         5839     5839           
  Misses        225      225           
  Partials      124      124           
Flag Coverage Δ
unittests 94.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrydingliu

Copy link
Copy Markdown
Member

given how many files this PR is currently touching, i'm hoping the following comes across as a scope reduction, rather than creep

is it possible for a github action to simply warn or recommends fixes for a new ruff rule? if it's possible, i would recommend that we go that route. basically, for future PRs, this action would run on changed files, and recommend fixes.

@Abhayindia Abhayindia changed the title [CHORE] Sort imports with ruff isort rules [CHORE] Suggest ruff import sorting on changed files Oct 31, 2026
@Abhayindia

Abhayindia commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

@henrydingliu

Yes, it is possible, so I reworked the PR that way: the 130-file reformat is reverted and the Ruff workflow has a step that shows the import-sorting diff for the files a PR changes, without failing the job. The net change is now 2 files (+21 lines), and its first real run is this PR's own Ruff job.

@henrydingliu
henrydingliu merged commit 00799bd into casact:main Oct 31, 2026
11 checks 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.

[RUFF] add [tool.ruff.lint.isort] rules to pyproject.toml

2 participants