Merge branch 'bug/178' into 'master'

Match noqa for users with explanations

*Description of changes*

*Related to:*  #178

See merge request !99
This commit is contained in:
Ian Cordasco 2016-07-28 12:28:38 +00:00
commit 53455fdff7
4 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,10 @@
3.0.3 -- 2016-07-28 (unreleased)
--------------------------------
- Fix ``# noqa`` comments followed by a ``:`` and explanation broken by
3.0.0 (See also `GitLab#178`_)
.. links
.. _GitLab#178:
https://gitlab.com/pycqa/flake8/issues/178

View file

@ -6,6 +6,7 @@ All of the release notes that have been recorded for Flake8 are organized here
with the newest releases first.
.. toctree::
3.0.3
3.0.2
3.0.1
3.0.0

View file

@ -27,7 +27,7 @@ NOQA_INLINE_REGEXP = re.compile(
# 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-Z][0-9]+,?)+))?',
re.IGNORECASE
)

View file

@ -130,6 +130,7 @@ def test_should_report_error(select_list, ignore_list, error_code, expected):
('E111', 'a = 1 # noqa, analysis:ignore', True),
('E111', 'a = 1 # noqa analysis:ignore', True),
('E111', 'a = 1 # noqa - We do not care', 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``."""