Skip to content

Conversation

@DudeNr33
Copy link
Collaborator

  • Write a good description on what the PR does.
  • If you used multiple emails or multiple names when contributing, add your mails
    and preferred name in script/.contributors_aliases.json

Type of Changes

Type
🔨 Refactoring

Description

As discussed in #6060, @check_messages has no effect in the following cases:

  1. Decorating a method that does not start with visit_* or leave_*: https://github.com/PyCQA/pylint/blob/ebf7bd6793dc484513455d0c47acd6a285a8d1a5/pylint/utils/ast_walker.py#L35-L46)
  2. Passing in all messages this checker defines with @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

@coveralls
Copy link

coveralls commented Apr 16, 2022

Pull Request Test Coverage Report for Build 2177892943

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 77 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.07%) to 95.114%

Files with Coverage Reduction New Missed Lines %
pylint/utils/linterstats.py 1 95.83%
pylint/config/arguments_provider.py 2 93.94%
pylint/config/init.py 6 69.35%
pylint/checkers/base_checker.py 13 88.5%
pylint/checkers/similar.py 13 96.31%
pylint/lint/run.py 15 84.16%
pylint/checkers/utils.py 27 96.02%
Totals Coverage Status
Change from base Build 2175996437: 0.07%
Covered Lines: 15710
Relevant Lines: 16517

💛 - 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())))
Copy link
Collaborator

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:
Copy link
Collaborator

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..

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@Pierre-Sassoulas Pierre-Sassoulas added performance Maintenance Discussion or action around maintaining pylint or the dev workflow labels Apr 16, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.0 milestone Apr 16, 2022
@DudeNr33 DudeNr33 merged commit 7c848b9 into pylint-dev:main Apr 17, 2022
@DudeNr33 DudeNr33 deleted the cleanup-useless-check-messages branch April 17, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintenance Discussion or action around maintaining pylint or the dev workflow performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants