-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[pylint
] Redefined outer names (PLW0621
)
#15903
base: main
Are you sure you want to change the base?
Conversation
That's weird. I'm pretty sure tests did pass when I wrote them two weeks ago. |
6b7c034
to
a043bb8
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PLW0621 | 6440 | 6440 | 0 | 0 | 0 |
D415 | 6 | 3 | 3 | 0 | 0 |
DOC201 | 4 | 2 | 2 | 0 | 0 |
ANN201 | 4 | 2 | 2 | 0 | 0 |
D400 | 4 | 2 | 2 | 0 | 0 |
D103 | 4 | 2 | 2 | 0 | 0 |
D202 | 2 | 1 | 1 | 0 | 0 |
a043bb8
to
0784de9
Compare
Many of the violations look like this, where all a = 0
def foo(a):
...
def v():
foo(a) I'm in favor of reporting them, since such a parameter is unnecessary anyway, but the message/rule documentation could probably be improved to avoid potential confusion. |
Would you mind explaining what makes this rule a partial implementation of I don't think we should merge this as a ruff rule right now. It seems too opinionated. I'm okay to accept this as a pylint rule (if it is semantically close/the same) |
(
|
Thanks for the extra context. I don't think we should add a rule as a RUF rule that actually is a pylint rule that we later have to recode if it implements the full scope of the upstream rule. Especially if we don't understand what the differences are. I recommend to:
|
e99f284
to
384bd65
Compare
ruff
] Overshadowing parameters (RUF059
)pylint
] Redefined outer names (PLW0621
)
Would you mind listing the differences to the upstream rule? Or do we still not know? |
1921f6a
to
7412149
Compare
@MichaReiser The upstream rule also reports variables and seems to have something to do with except handlers. Whatever I could make out of it I have already incorporated into the code. Due to some reason, |
5dcd87c
to
e392ebd
Compare
Summary
Part of #970 and #3040.
This partial implementation of
W0621
reports parameters that overshadow a variable from an outer scope. Pytest (yield) fixtures are exempted from the rule.The error message was taken from that of the upstream rule.
Test Plan
cargo nextest run
andcargo insta test
.