-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add error-code for truthy-iterable
#13762
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,10 @@ def with_additional_msg(self, info: str) -> ErrorMessage: | |
FUNCTION_ALWAYS_TRUE: Final = ErrorMessage( | ||
"Function {} could always be true in boolean context", code=codes.TRUTHY_FUNCTION | ||
) | ||
ITERABLE_ALWAYS_TRUE: Final = ErrorMessage( | ||
"{} which can always be true in boolean context. Consider using {} instead.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This message reads a bit weird to me but I guess it's consistent with the other ALWAYS_TRUE messages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On its own, I agree. It gets better once the variables are inserted. E.g.
|
||
code=codes.TRUTHY_ITERABLE, | ||
) | ||
NOT_CALLABLE: Final = "{} not callable" | ||
TYPE_MUST_BE_USED: Final = "Value of type {} must be used" | ||
|
||
|
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 don't understand what this sentence is trying to say. What is "this" exactly?
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.
As best as I can tell, "this" refers to the check itself and the fact that it doesn't highlight a concrete issue but rather only a potential one.