diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-28 06:25:41 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-28 06:48:15 -0500 |
| commit | c0ddc54f2f5e3f453735780e639be08ef3b15e2d (patch) | |
| tree | e78fc7af443f0d7376ff9be23785b84ecadd2dc8 | |
| parent | 47e3e65cc1734e46fd16ea11622e57b7978d3e0d (diff) | |
| download | flake8-bug/178.tar.gz | |
Match noqa for users with explanationsbug/178
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
| -rw-r--r-- | docs/source/release-notes/3.0.3.rst | 10 | ||||
| -rw-r--r-- | docs/source/release-notes/index.rst | 1 | ||||
| -rw-r--r-- | src/flake8/defaults.py | 2 | ||||
| -rw-r--r-- | tests/unit/test_style_guide.py | 1 |
4 files changed, 13 insertions, 1 deletions
diff --git a/docs/source/release-notes/3.0.3.rst b/docs/source/release-notes/3.0.3.rst new file mode 100644 index 0000000..40c9258 --- /dev/null +++ b/docs/source/release-notes/3.0.3.rst @@ -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 diff --git a/docs/source/release-notes/index.rst b/docs/source/release-notes/index.rst index 440079b..81cd1ab 100644 --- a/docs/source/release-notes/index.rst +++ b/docs/source/release-notes/index.rst @@ -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 diff --git a/src/flake8/defaults.py b/src/flake8/defaults.py index 73cadf1..e3ac9fb 100644 --- a/src/flake8/defaults.py +++ b/src/flake8/defaults.py @@ -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 ) diff --git a/tests/unit/test_style_guide.py b/tests/unit/test_style_guide.py index 4efbca5..f5a2caa 100644 --- a/tests/unit/test_style_guide.py +++ b/tests/unit/test_style_guide.py @@ -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``.""" |
