Skip to content

Commit e0234d9

Browse files
Add a test to check that no old msgid or symbol are used
Closes #5729
1 parent 15040ee commit e0234d9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2+
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
3+
from typing import TYPE_CHECKING, List, NamedTuple, Tuple
4+
5+
if TYPE_CHECKING:
6+
from pylint.lint import PyLinter
7+
8+
9+
class DeletedMessage(NamedTuple):
10+
msgid: str
11+
symbol: str
12+
old_names: List[Tuple[str, str]]
13+
14+
15+
OLD_MSGID_SYMBOL_PAIR = [
16+
DeletedMessage("W1601", "apply-builtin", []),
17+
]
18+
19+
20+
def test_no_removed_msgid_or_symbol_used(linter: "PyLinter") -> None:
21+
"""Tests that we're not using deleted msgid or symbol.
22+
23+
This would be causing occasional bug, but more than that confusion and inconsistencies
24+
when searching for the msgid online. See https://github.com/PyCQA/pylint/issues/5729
25+
"""
26+
for msgid, symbol, old_names in OLD_MSGID_SYMBOL_PAIR:
27+
linter.msgs_store.message_id_store.register_message_definition(
28+
msgid, symbol, old_names
29+
)

0 commit comments

Comments
 (0)