-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove pointless check_messages decorators
#6353
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
Remove pointless check_messages decorators
#6353
Conversation
Pull Request Test Coverage Report for Build 2177892943
💛 - Coveralls |
| self.add_message("isinstance-second-argument-not-valid-type", node=node) | ||
|
|
||
| # pylint: disable=too-many-branches,too-many-locals | ||
| @check_messages(*(list(MSGS.keys()))) |
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.
😅
| break | ||
|
|
||
| @check_messages("unsupported-binary-operation") | ||
| def _visit_binop(self, node: nodes.BinOp) -> None: |
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.
Do you understand why these are underscored? They don't seem to be called in this file..
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 saw that the functional test for this message (unsupported-binary-operation) is always skipped, with the following comment:
Disable for unsupported-binary-operation
Unfortunately, this warning exhibits currently way too many false
positives, practically rendering this error useless. I can't fix
all of them until I release Pylint 1.5, so the most reasonable
choice for now is to disable it and reenable it as soon as we fix
those problems.
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.
Oh wow, we should probably follow up on that..
But then the decorator is "correct" we only need to de-underscore this function right? Perhaps we should keep the decorator and add a TODO to fix this?
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.
You are right - if we plan to re-enable this check, the decorator should stay. Will fix this and add a TODO.
and preferred name in
script/.contributors_aliases.jsonType of Changes
Description
As discussed in #6060,
@check_messageshas no effect in the following cases:visit_*orleave_*: https://github.com/PyCQA/pylint/blob/ebf7bd6793dc484513455d0c47acd6a285a8d1a5/pylint/utils/ast_walker.py#L35-L46)@check_messages(*MSGS). This has the same effect as not decorating it at all:https://github.com/PyCQA/pylint/blob/ebf7bd6793dc484513455d0c47acd6a285a8d1a5/pylint/utils/ast_walker.py#L20-L23
If none of the checker's messages is enabled, we won't load it anyway:
https://github.com/PyCQA/pylint/blob/ebf7bd6793dc484513455d0c47acd6a285a8d1a5/pylint/lint/pylinter.py#L987-L997