Skip to content

Commit

Permalink
Allow numbers in checker names.
Browse files Browse the repository at this point in the history
This fixes pylint-dev#3666.
  • Loading branch information
jfly committed Jun 5, 2020
1 parent 627d07d commit 9ae12e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pylint/utils/pragma_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

TOKEN_SPECIFICATION = [
("KEYWORD", r"\b({:s})\b".format(ALL_KEYWORDS)),
("MESSAGE_STRING", r"[A-Za-z\-\_]{2,}"), #  Identifiers
("MESSAGE_STRING", r"[0-9A-Za-z\-\_]{2,}"), #  Identifiers
("ASSIGN", r"="), #  Assignment operator
("MESSAGE_NUMBER", r"[CREIWF]{1}\d*"),
]
Expand Down
8 changes: 8 additions & 0 deletions tests/test_pragma_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ def test_simple_pragma():
assert pragma_repr.messages == ["missing-docstring"]


def test_disable_checker_with_number_in_name():
comment = "#pylint: disable = j3-custom-checker"
match = OPTION_PO.search(comment)
for pragma_repr in parse_pragma(match.group(2)):
assert pragma_repr.action == "disable"
assert pragma_repr.messages == ["j3-custom-checker"]


def test_simple_pragma_no_messages():
comment = "#pylint: skip-file"
match = OPTION_PO.search(comment)
Expand Down

0 comments on commit 9ae12e8

Please sign in to comment.