diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-09-15 20:42:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 20:42:22 +0200 |
commit | 22e56c07cf745d695df1d52fe3988cc071f0951b (patch) | |
tree | 713b888a2f24239932b7d8a6a1d9f8bffe0026cd /pylint/checkers/base_checker.py | |
parent | cb896128b0e8f62c0650e980ef77a3c8af21ef8d (diff) | |
download | pylint-git-22e56c07cf745d695df1d52fe3988cc071f0951b.tar.gz |
Add typing to all calls to ``self.stats`` (#4973)
* Add typing to all calls to ``self.stats``
All checkers inherit from a baseclass which has a ``stats`` attribute.
This attribute has a fairly unmanageable type, but the current typing includes all variations of the attribute.
Other changes not directly related to ``self.stats`` are due to ``mypy``warnings.
This incorporate the feedback received in #4954
* Add ``CheckerStatistic`` class to ``pylint/typing``
* Guard `typing.Counter` import
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'pylint/checkers/base_checker.py')
-rw-r--r-- | pylint/checkers/base_checker.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py index 5dfd7ea78..791a3cb1e 100644 --- a/pylint/checkers/base_checker.py +++ b/pylint/checkers/base_checker.py @@ -24,6 +24,7 @@ from pylint.constants import _MSG_ORDER, WarningScope from pylint.exceptions import InvalidMessageError from pylint.interfaces import UNDEFINED, IRawChecker, ITokenChecker, implements from pylint.message.message_definition import MessageDefinition +from pylint.typing import CheckerStats from pylint.utils import get_rst_section, get_rst_title @@ -51,6 +52,7 @@ class BaseChecker(OptionsProviderMixIn): self.name = self.name.lower() OptionsProviderMixIn.__init__(self) self.linter = linter + self.stats: CheckerStats = {} def __gt__(self, other): """Permit to sort a list of Checker by name.""" |