未验证 提交 c0ddc54f 编辑于 作者: Ian Cordasco's avatar Ian Cordasco
浏览文件

Match noqa for users with explanations

This makes the regular expression a bit more complex, and potentially
slower, but it will fix the issue where users had noqa comments with
colons followed by explanations.

Closes #178
显示 13 个添加1 个删除
+13 -1
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
......@@ -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
......
......@@ -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
)
......
......@@ -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``."""
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册