Add a lint checking for warnings.warn stacklevel argument#342
Merged
cooperlees merged 4 commits intoPyCQA:mainfrom Feb 2, 2023
Merged
Add a lint checking for warnings.warn stacklevel argument#342cooperlees merged 4 commits intoPyCQA:mainfrom
cooperlees merged 4 commits intoPyCQA:mainfrom
Conversation
cooperlees
approved these changes
Jan 31, 2023
Collaborator
cooperlees
left a comment
There was a problem hiding this comment.
Many thanks. I've seen this a lot and is a good new addition to me. I'm also happy to reuse B028 since we renamed the old check to be optional ...
Will leave for 24 hours to let others comment.
Contributor
|
Since B028 had a bunch of false positives I suspect there are going to be some configs out there that disabled it, and unless they closely track development haven't re-enabled it since it became optional. But I suspect there's not a ton of those, and B028 was renamed within three days, so it's probably fine to expect those people to update their configs. But one could also let B028 be for some time before using it again. (it would be nice if there was a warning for disabled checks that don't exist... 🤔) |
This file contains hidden or 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
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.
This PR adds a lint which checks for an explicitly defined
stacklevelkeyword argument on thewarnmethod from thewarningsmodule. Ifstacklevelis not explicitly defined, this lint triggers. See #299 for more information.I am new to this project and ASTs in general, so any feedback is appreciated! Specifically I don't know whether this should be
B028orB029, asB028was used before byB907.Closes #299