summaryrefslogtreecommitdiff
path: root/pylint/checkers/base_checker.py
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@users.noreply.github.com>2022-06-16 11:32:10 +0200
committerGitHub <noreply@github.com>2022-06-16 11:32:10 +0200
commite666506158feab03630c37dfb9bf9fd498f7a52a (patch)
treece1c4a9d3f18c440f4e81f0d4a8785acdcddf53f /pylint/checkers/base_checker.py
parent600a47e13e3df1ca42521c653ab0ebed5739d485 (diff)
downloadpylint-git-e666506158feab03630c37dfb9bf9fd498f7a52a.tar.gz
Add support of sharing message in multiple checkers. Fix DeprecatedChecker example (#6693)
* Move message definitions from DeprecatedMixin * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Added typing and fixed unittests * Make DEPRECATED_MSGS and DEPRECATED_IMPORT_MSG class variables to make pylint happy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Introduce shared messages * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Change Message codes in DeprecatedMixin to W49XX * Make mypy happy * Make pylint happy * Add support for building documentation for shared messages * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make isort happy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Circuvent isort * Move shared to extra message options and fix tests * Update deprecation_checker example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update doc/exts/pylint_messages.py Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> * Update doc/exts/pylint_messages.py Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> * Make messages static class attributes * Keep MessageDefinition backward compatible * Apply suggestions from code review Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'pylint/checkers/base_checker.py')
-rw-r--r--pylint/checkers/base_checker.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py
index a2dfe7b17..37ae236d2 100644
--- a/pylint/checkers/base_checker.py
+++ b/pylint/checkers/base_checker.py
@@ -178,6 +178,10 @@ class BaseChecker(_ArgumentsProvider):
checker_id = None
existing_ids = []
for message in self.messages:
+ # Id's for shared messages such as the 'deprecated-*' messages
+ # can be inconsistent with their checker id.
+ if message.shared:
+ continue
if checker_id is not None and checker_id != message.msgid[1:3]:
error_msg = "Inconsistent checker part in message id "
error_msg += f"'{message.msgid}' (expected 'x{checker_id}xx' "