summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2018-10-28 20:25:53 +0000
committerAnthony Sottile <asottile@umich.edu>2018-10-28 20:25:53 +0000
commit732a466ee8eec06d195ec70081e53ec187b5b114 (patch)
tree3eebe71fd3549c1b0b2b8040885e7705d54e4744
parent4773995430e56f5669861438cc3ce2845953ad51 (diff)
parentcafe7805147a44959038dfb489a95d157a8e43b9 (diff)
downloadflake8-732a466ee8eec06d195ec70081e53ec187b5b114.tar.gz
Merge branch 'defect/469-improve-inline-noqa-regex-comment-and-documentation' into 'master'
Clearer docs, NOQA_INLINE_REGEXP comment - fixes #469 Closes #469 See merge request pycqa/flake8!262
-rw-r--r--README.rst2
-rw-r--r--docs/source/user/violations.rst5
-rw-r--r--src/flake8/defaults.py2
3 files changed, 5 insertions, 4 deletions
diff --git a/README.rst b/README.rst
index 9c5f3c6..a182b9b 100644
--- a/README.rst
+++ b/README.rst
@@ -19,7 +19,7 @@ It also adds a few features:
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- you can ignore specific errors on a line with ``# noqa: <error>``, e.g.,
- ``# noqa: E234``
+ ``# noqa: E234``. Multiple codes can be given, separated by comma. The ``noqa`` token is case insensitive, the colon before the list of codes is required otherwise the part after ``noqa`` is ignored
- Git and Mercurial hooks
- extendable through ``flake8.extension`` and ``flake8.formatting`` entry
points
diff --git a/docs/source/user/violations.rst b/docs/source/user/violations.rst
index 73a2f2a..5076a96 100644
--- a/docs/source/user/violations.rst
+++ b/docs/source/user/violations.rst
@@ -85,12 +85,13 @@ what is actually happening. In those cases, we can also do:
This will only ignore the error from pycodestyle that checks for lambda
assignments and generates an ``E731``. If there are other errors on the line
-then those will be reported.
+then those will be reported. ``# noqa`` is case-insensitive, without the colon
+the part after ``# noqa`` would be ignored.
.. note::
If we ever want to disable |Flake8| respecting ``# noqa`` comments, we can
- can refer to :option:`flake8 --disable-noqa`.
+ refer to :option:`flake8 --disable-noqa`.
If we instead had more than one error that we wished to ignore, we could
list all of the errors with commas separating them:
diff --git a/src/flake8/defaults.py b/src/flake8/defaults.py
index 61f2571..ec68067 100644
--- a/src/flake8/defaults.py
+++ b/src/flake8/defaults.py
@@ -30,7 +30,7 @@ NOQA_INLINE_REGEXP = re.compile(
# ``# noqa: E123,W451,F921``
# ``# NoQA: E123,W451,F921``
# ``# NOQA: E123,W451,F921``
- # We do not care about the ``: `` that follows ``noqa``
+ # We do not want to capture the ``: `` that follows ``noqa``
# We do not care about the casing of ``noqa``
# We want a comma-separated list of errors
r"# noqa(?:: (?P<codes>([A-Z][0-9]+(?:[,\s]+)?)+))?",