Support hyphens within a flake8 custom plugin code

Prior to this change, a code had to be formatted as a series of characters
followed by a series of numbers.

This change updates the format to require the first character to be a
letter, followed by any number of letters, numbers, or hyphens.
This commit is contained in:
Josh Smeaton 2022-03-15 21:21:34 +11:00
parent 94ed800b2a
commit 722bd6a9e5
2 changed files with 6 additions and 3 deletions

View file

@ -99,6 +99,11 @@ def test_parse_comma_separated_list(value, expected):
"f.py: ABC123",
[("f.py", ["ABC123"])],
),
# hyphens are allowed
(
"f.py: COMPANY-NAME-SPACE-123,COMPANY-NAME-SPACE-321",
[("f.py", ["COMPANY-NAME-SPACE-123", "COMPANY-NAME-SPACE-321"])],
),
),
)
def test_parse_files_to_codes_mapping(value, expected):
@ -118,8 +123,6 @@ def test_parse_files_to_codes_mapping(value, expected):
"f.py:E,g.py"
# colon while looking for codes
"f.py::",
# no separator between
"f.py:E1F1",
),
)
def test_invalid_file_list(value):