diff options
author | Matus Valo <matusvalo@users.noreply.github.com> | 2022-06-16 11:32:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 11:32:10 +0200 |
commit | e666506158feab03630c37dfb9bf9fd498f7a52a (patch) | |
tree | ce1c4a9d3f18c440f4e81f0d4a8785acdcddf53f /pylint/checkers/deprecated.py | |
parent | 600a47e13e3df1ca42521c653ab0ebed5739d485 (diff) | |
download | pylint-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/deprecated.py')
-rw-r--r-- | pylint/checkers/deprecated.py | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/pylint/checkers/deprecated.py b/pylint/checkers/deprecated.py index ea33ff6bc..78d73586b 100644 --- a/pylint/checkers/deprecated.py +++ b/pylint/checkers/deprecated.py @@ -31,31 +31,48 @@ class DeprecatedMixin(BaseChecker): A class implementing mixin must define "deprecated-method" Message. """ - msgs: dict[str, MessageDefinitionTuple] = { - "W1505": ( + DEPRECATED_MODULE_MESSAGE: dict[str, MessageDefinitionTuple] = { + "W4901": ( + "Deprecated module %r", + "deprecated-module", + "A module marked as deprecated is imported.", + {"old_names": [("W0402", "old-deprecated-module")], "shared": True}, + ), + } + + DEPRECATED_METHOD_MESSAGE: dict[str, MessageDefinitionTuple] = { + "W4902": ( "Using deprecated method %s()", "deprecated-method", "The method is marked as deprecated and will be removed in the future.", + {"old_names": [("W1505", "old-deprecated-method")], "shared": True}, ), - "W1511": ( + } + + DEPRECATED_ARGUMENT_MESSAGE: dict[str, MessageDefinitionTuple] = { + "W4903": ( "Using deprecated argument %s of method %s()", "deprecated-argument", "The argument is marked as deprecated and will be removed in the future.", + {"old_names": [("W1511", "old-deprecated-argument")], "shared": True}, ), - "W0402": ( - "Deprecated module %r", - "deprecated-module", - "A module marked as deprecated is imported.", - ), - "W1512": ( + } + + DEPRECATED_CLASS_MESSAGE: dict[str, MessageDefinitionTuple] = { + "W4904": ( "Using deprecated class %s of module %s", "deprecated-class", "The class is marked as deprecated and will be removed in the future.", + {"old_names": [("W1512", "old-deprecated-class")], "shared": True}, ), - "W1513": ( + } + + DEPRECATED_DECORATOR_MESSAGE: dict[str, MessageDefinitionTuple] = { + "W4905": ( "Using deprecated decorator %s()", "deprecated-decorator", "The decorator is marked as deprecated and will be removed in the future.", + {"old_names": [("W1513", "old-deprecated-decorator")], "shared": True}, ), } |