-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ci] use Ruff linter instead of isort #6755
Conversation
@@ -2507,13 +2507,13 @@ def _compare_params_for_warning( | |||
compare_result : bool | |||
Returns whether two dictionaries with params are equal. | |||
""" | |||
for k in other_params: | |||
for k, v in other_params.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix PLC0206 in new Ruff version.
return False | ||
for k in params: | ||
for k, v in params.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix PLC0206 in new Ruff version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -154,6 +143,7 @@ select = [ | |||
"D", | |||
# pycodestyle | |||
"E", | |||
"W", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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 putisort
after"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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 4cb519e. Is it OK now?
python-package/pyproject.toml
Outdated
# isort | ||
"I", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable isort.
@@ -196,3 +188,6 @@ select = [ | |||
|
|||
[tool.ruff.lint.pydocstyle] | |||
convention = "numpy" | |||
|
|||
[tool.ruff.lint.isort] | |||
known-first-party = ["lightgbm"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like this, thanks very much1
return False | ||
for k in params: | ||
for k, v in params.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, I'm impressed that a linter could look in this far and find something like this! Really nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-approving
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.