-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
] Don't emit used-dummy-variable
on function parameters (RUF052
)
#14818
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlexWaygood
added
bug
Something isn't working
preview
Related to preview mode features
labels
Dec 6, 2024
AlexWaygood
changed the title
[
[Dec 6, 2024
ruff
] Dont emit RUF052 on function parametersruff
] Dont emit used-dummy-variable
on function parameters (RUF052
)
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RUF052 | 255 | 0 | 255 | 0 | 0 |
DOC501 | 2 | 1 | 1 | 0 | 0 |
AlexWaygood
changed the title
[
[Dec 6, 2024
ruff
] Dont emit used-dummy-variable
on function parameters (RUF052
)ruff
] Don't emit used-dummy-variable
on function parameters (RUF052
)
zanieb
approved these changes
Dec 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #14796.
Fixes #14790.
Fixes #14799.
There isn't nearly as much community consensus around the idea that using a leading underscore for a function parameter indicates the binding is meant to be "unused"; many people use this to indicate "private" parameters. Even if we decide that we don't believe that private parameters should be recognised as a concept by Ruff, I think emitting this lint on function parameters would still need to be behind a configuration flag (or maybe even a separate rule altogether), as it's just a lot more controversial than the other changes this rule makes IMO.
I agree with @zanieb's comment in #14796 (comment) that the logical conclusion of this argument is that we should probably look into whether we should change the behaviour for
ARG001
. Unfortunately we'll only be able to do that in the next minor release, however, as it would be an increase in the scope ofARG001
. I can open an issue for that after this PR is merged, so that we don't forget.Test Plan
cargo test -p ruff_linter --lib