mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 18:46:52 +00:00
Update NOQA regular expression
This allows for other text after `# noqa`. Related to #180
This commit is contained in:
parent
88d9213962
commit
f82b5d62d0
2 changed files with 4 additions and 1 deletions
|
|
@ -63,7 +63,7 @@ class StyleGuide(object):
|
|||
# We do not care about the ``: `` that follows ``noqa``
|
||||
# We do not care about the casing of ``noqa``
|
||||
# We want a comma-separated list of errors
|
||||
'# noqa(?:: )?(?P<codes>[A-Z0-9,]+)?$',
|
||||
'# noqa(?:: (?P<codes>[A-Z0-9,]+))?',
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,9 @@ def test_should_report_error(select_list, ignore_list, error_code, expected):
|
|||
('E111', 'a = 1 # noqa: E111,W123,F821', True),
|
||||
('W123', 'a = 1 # noqa: E111,W123,F821', True),
|
||||
('E111', 'a = 1 # noqa: E11,W123,F821', True),
|
||||
('E111', 'a = 1 # noqa, analysis:ignore', True),
|
||||
('E111', 'a = 1 # noqa analysis:ignore', True),
|
||||
('E111', 'a = 1 # noqa - We do not care', True),
|
||||
])
|
||||
def test_is_inline_ignored(error_code, physical_line, expected_result):
|
||||
"""Verify that we detect inline usage of ``# noqa``."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue