Skip to content

Commit

Permalink
Update NOQA regular expression
Browse files Browse the repository at this point in the history
This allows for other text after `# noqa`.

Related to #180
  • Loading branch information
sigmavirus24 committed Jul 26, 2016
1 parent 88d9213 commit f82b5d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/flake8/style_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_style_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``."""
Expand Down

0 comments on commit f82b5d6

Please sign in to comment.