[ci] use Ruff linter instead of isort#6755
Conversation
| Returns whether two dictionaries with params are equal. | ||
| """ | ||
| for k in other_params: | ||
| for k, v in other_params.items(): |
| if k not in params or params[k] != v: | ||
| return False | ||
| for k in params: | ||
| for k, v in params.items(): |
There was a problem hiding this comment.
oh wow, I'm impressed that a linter could look in this far and find something like this! Really nice.
python-package/pyproject.toml
Outdated
| "D", | ||
| # pycodestyle | ||
| "E", | ||
| "W", |
There was a problem hiding this comment.
There was a problem hiding this comment.
| "W", | |
| # pycodestyle (warnings) | |
| "W", |
Sorry, missed this before I approved.
Could you:
- add a comment like this one
- change the comment over
"E"# pycodestyle (errors) - keep this list alphabetically organized by rule code (so move this
"W"to the end, and putisortafter"F"
I think that makes it a bit easier to find the relevant entry in the config and map it to the type of check.
Very very minor suggestion, so if you disagree at all then just merge this.
python-package/pyproject.toml
Outdated
| # isort | ||
| "I", |
| convention = "numpy" | ||
|
|
||
| [tool.ruff.lint.isort] | ||
| known-first-party = ["lightgbm"] |
There was a problem hiding this comment.
jameslamb
left a comment
There was a problem hiding this comment.
Really like this, thanks very much1
| if k not in params or params[k] != v: | ||
| return False | ||
| for k in params: | ||
| for k, v in params.items(): |
There was a problem hiding this comment.
oh wow, I'm impressed that a linter could look in this far and find something like this! Really nice.
|
This pull request has been automatically locked since there has not been any recent activity since it was closed. |
Let Ruff work with imports sorting directly.
This change speeds up the pre-commit job, avoids situations where ruff and isort are fighting each other and allows to consistenly configure only one tool.
Refer to: https://docs.astral.sh/ruff/faq/#how-does-ruffs-import-sorting-compare-to-isort.
Also, bump versions of pre-commit libraries.