-
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
Changes from 28 commits
3f15a23
7ea1a24
4d576fd
38e0469
4517bc1
f34a888
ac6cca0
108e6a2
b583b45
0105e50
e396c48
3510f74
42a4faa
1a4907a
6326dea
a72a0e6
40a9c8f
6648c7b
79f1395
bd12804
cc0e5f6
28034f4
de0a23b
aba520f
9e020c0
ab21c88
1cf908d
f6dcaf4
4cb519e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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(): | ||
if k not in ignore_keys: | ||
if k not in params or params[k] != other_params[k]: | ||
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. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
if k not in ignore_keys: | ||
if k not in other_params or params[k] != other_params[k]: | ||
if k not in other_params or v != other_params[k]: | ||
return False | ||
return True | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -84,17 +84,6 @@ minimum-version = "build-system.requires" | |||||||
|
||||||||
# end:build-system | ||||||||
|
||||||||
[tool.isort] | ||||||||
include_trailing_comma = true | ||||||||
line_length = 120 | ||||||||
# "vertical hanging indent", to match what ruff-format does | ||||||||
# ref: https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html#3-vertical-hanging-indent | ||||||||
multi_line_output = 3 | ||||||||
skip_glob = [ | ||||||||
"*/external_libs/*", | ||||||||
"*/lightgbm-python/*", | ||||||||
] | ||||||||
|
||||||||
[tool.mypy] | ||||||||
disallow_untyped_defs = true | ||||||||
exclude = 'build/*|compile/*|docs/*|examples/*|external_libs/*|lightgbm-python/*|tests/*' | ||||||||
|
@@ -140,7 +129,7 @@ ignore = [ | |||||||
"PLR1714", | ||||||||
# (pylint) Magic value used in comparison | ||||||||
"PLR2004", | ||||||||
# (pylint) for loop veriable overwritten by assignment target | ||||||||
# (pylint) for loop variable overwritten by assignment target | ||||||||
"PLW2901", | ||||||||
# (pylint) use 'elif' instead of 'else' then 'if', to reduce indentation | ||||||||
"PLR5501" | ||||||||
|
@@ -154,6 +143,7 @@ select = [ | |||||||
"D", | ||||||||
# pycodestyle | ||||||||
"E", | ||||||||
"W", | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Sorry, missed this before I approved. Could you:
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Done in 4cb519e. Is it OK now? |
||||||||
# pyflakes | ||||||||
"F", | ||||||||
# NumPy-specific rules | ||||||||
|
@@ -166,11 +156,13 @@ select = [ | |||||||
"SIM401", | ||||||||
# flake8-print | ||||||||
"T", | ||||||||
# isort | ||||||||
"I", | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enable isort. |
||||||||
] | ||||||||
|
||||||||
[tool.ruff.lint.per-file-ignores] | ||||||||
"docs/conf.py" = [ | ||||||||
# (flake8-bugbear) raise exceptions with "raise ... from errr" | ||||||||
# (flake8-bugbear) raise exceptions with "raise ... from err" | ||||||||
"B904", | ||||||||
# (flake8-print) flake8-print | ||||||||
"T" | ||||||||
|
@@ -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 commentThe 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.
Fix PLC0206 in new Ruff version.