mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-08 14:04:16 +00:00
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:
commit
53455fdff7
4 changed files with 13 additions and 1 deletions
10
docs/source/release-notes/3.0.3.rst
Normal file
10
docs/source/release-notes/3.0.3.rst
Normal 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
|
||||||
|
|
@ -6,6 +6,7 @@ All of the release notes that have been recorded for Flake8 are organized here
|
||||||
with the newest releases first.
|
with the newest releases first.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
3.0.3
|
||||||
3.0.2
|
3.0.2
|
||||||
3.0.1
|
3.0.1
|
||||||
3.0.0
|
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 ``: `` that follows ``noqa``
|
||||||
# We do not care about the casing of ``noqa``
|
# We do not care about the casing of ``noqa``
|
||||||
# We want a comma-separated list of errors
|
# We want a comma-separated list of errors
|
||||||
'# noqa(?:: (?P<codes>[A-Z0-9,]+))?',
|
'# noqa(?:: (?P<codes>([A-Z][0-9]+,?)+))?',
|
||||||
re.IGNORECASE
|
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 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),
|
||||||
|
('E111', 'a = 1 # noqa: We do not care', True),
|
||||||
])
|
])
|
||||||
def test_is_inline_ignored(error_code, physical_line, expected_result):
|
def test_is_inline_ignored(error_code, physical_line, expected_result):
|
||||||
"""Verify that we detect inline usage of ``# noqa``."""
|
"""Verify that we detect inline usage of ``# noqa``."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue