-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Ruff 0.6] Stabilise 9 pylint rules #12857
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLW0642 | 52 | 52 | 0 | 0 | 0 |
PLR1730 | 13 | 13 | 0 | 0 | 0 |
PLW0211 | 1 | 1 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+52 -52 violations, +0 -0 fixes in 2 projects; 52 projects unchanged)
bokeh/bokeh (+1 -1 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ src/bokeh/events.py:182:9: PLW0642 Confusing assignment to `cls` argument in class method - src/bokeh/events.py:182:9: PLW0642 Invalid assignment to `cls` argument in class method
pandas-dev/pandas (+51 -51 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ pandas/core/arrays/categorical.py:572:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/categorical.py:572:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1065:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1065:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1080:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1080:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1081:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1081:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1109:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1109:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1118:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1118:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1129:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1129:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1131:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1131:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1136:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1136:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1185:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1185:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1187:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1187:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1203:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1203:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1260:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1260:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1274:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1274:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1480:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1480:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:1699:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:1699:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:2131:17: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:2131:17: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:2153:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:2153:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:456:17: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:456:17: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:778:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:778:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/arrays/datetimelike.py:979:13: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/arrays/datetimelike.py:979:13: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/frame.py:7827:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/frame.py:7827:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/frame.py:7840:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/frame.py:7840:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/frame.py:8183:9: PLW0642 Confusing assignment to `self` argument in instance method - pandas/core/frame.py:8183:9: PLW0642 Invalid assignment to `self` argument in instance method + pandas/core/frame.py:8195:21: PLW0642 Confusing assignment to `self` argument in instance method ... 53 additional changes omitted for project
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLW0642 | 104 | 52 | 52 | 0 | 0 |
The vast majority of the ecosystem hit here are PLR6104. I'll split that one out into its own PR so that it can be considered in isolation. (Edit: this has now been done; the PR for that is #12858) |
b54bc7c
to
e0bd79c
Compare
There's a lot of |
LGTM. My only feedback for |
Yeah, that's a great point. I think I'll change it to "confusing". It's not an invalid assignment; you could just write the code in a clearer/less confusing way by using a different variable name. |
|
||
fn fix_title(&self) -> Option<String> { | ||
Some("Consider using a different variable name".to_string()) | ||
} |
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.
This is clever ;)
format!( | ||
"Invalid assignment to `{}` argument in {method_type} method", | ||
"Confusing assignment to `{}` argument in {method_type} method", | ||
method_type.arg_name(), |
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.
Another option could be "Re-assigned {}
argument in {method_type} method"
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, that's better. Much more descriptive. I'll make another PR 😄
Summary
Stabilise the following rules for Ruff 0.6:
singledispatch-method
(PLE1519
)singledispatchmethod-function
(PLE1520
)bad-staticmethod-argument
(PLW0211
)if-stmt-min-max
(PLR1730
)invalid-bytes-return-type
(PLE0308
)invalid-hash-return-type
(PLE0309
)invalid-index-return-type
(PLE0305
)invalid-length-return-type
(E303
)non-augmented-assignment
(PLR6104
)self-or-cls-assignment
(PLW0642
)These rules all seem fairly uncontroversial, they've all been in preview for >3 months (and haven't changed much in a while), and none of them have any significant issues open about them that should block stabilisation IMO.
Test Plan
cargo test
, but the ecoystem report will be the real judge...