-
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
[Autofix request] B028: no-explicit-stacklevel #14805
Comments
Yeah, I agree that an unsafe autofix to |
Thanks for the confirm that would be really helpful :) |
@dylwil3 Really appreciate the quick fix, I noticed some minor relevant issues while cleaning up our code base:
I'm happy to open a separate issue to track this if you believe it's worth the effort and feel free to reject them :) |
Sure! Thanks for submitting the issue!
If a developer explicitly specifies the stacklevel it feels a little rude to contradict them 😄 We would also have to change the rule name and diagnostic message in that case. But I agree that the documentation around "Why this is bad" together with the autofix suggestion makes it sound like the rule is a little stricter than it is. So maybe there is some editing to be done to the message and/or documentation?
I don't think I know enough about the usage here to gauge whether this would be common/helpful, but please feel free to suggest this as a new lint rule in a separate issue and folks can weigh in. |
Thanks for the quick implementation again.
Yep I agree, they might know well what they're doing, so perhaps don't warn for such case. Also manual fixing for such cases is much easier, just do a regular expression search and replace.
I'm personally happy with the state of the docs. Our code base is built around chemistry so some people don't come from CS background to understand "stack", and they just don't bother to read the documentation and ended up passing a safe default
Thanks for the comment. I guess it's not worthy a issue as it's just a unnecessary default argument given (looks not so tidy but don't have any other side effect), there's no way for us to warn again every default value usage I guess :) Thanks again and all the best |
Can I request an autofix for B028: no-explicit-stacklevel?
I understand
stacklevel=2
may not be the one-size-fits-all solution (some implementation might need higher stack level), but I guess it's a good default value forruff
autofix?The text was updated successfully, but these errors were encountered: