-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test to check that no old msgid or symbol are used
Closes #5729
- Loading branch information
1 parent
b426411
commit a886026
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE | ||
from typing import TYPE_CHECKING, List, NamedTuple, Tuple | ||
|
||
if TYPE_CHECKING: | ||
from pylint.lint import PyLinter | ||
|
||
|
||
class DeletedMessage(NamedTuple): | ||
msgid: str | ||
symbol: str | ||
old_names: List[Tuple[str, str]] | ||
|
||
|
||
OLD_MSGID_SYMBOL_PAIR = [ | ||
DeletedMessage("W1601", "apply-builtin", []), | ||
] | ||
|
||
|
||
def test_no_removed_msgid_or_symbol_used(linter: "PyLinter") -> None: | ||
"""Tests that we're not using deleted msgid or symbol. | ||
This would be causing occasional bug, but more than that confusion and inconsistencies | ||
when searching for the msgid online. See https://github.com/PyCQA/pylint/issues/5729 | ||
""" | ||
for msgid, symbol, old_names in OLD_MSGID_SYMBOL_PAIR: | ||
linter.msgs_store.message_id_store.register_message_definition( | ||
msgid, symbol, old_names | ||
) |