-
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
[flake8-bugbear
] Offer unsafe autofix for no-explicit-stacklevel
(B028
)
#14829
Conversation
crates/ruff_linter/src/rules/flake8_bugbear/rules/no_explicit_stacklevel.rs
Outdated
Show resolved
Hide resolved
let mut diagnostic = Diagnostic::new(NoExplicitStacklevel, call.func.range()); | ||
|
||
let edit = add_argument( | ||
"stacklevel=2", |
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.
I'm super surprised this method doesn't need to know if this is a keyword or positional argument!
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.
I was also surprised... it seems like it would actually be unsafe to use this method for positional arguments, since it always adds the argument to the end? If that's correct and you'd like me to make a followup PR, let me know - I'd be happy to!
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.
Yeah feel free to take a look!
|
This PR introduces an unsafe autofix for no-explicit-stacklevel (B028): we add the
stacklevel
argument, set to2
.Closes #14805