Update regex to allow no space noqa

This commit is contained in:
Tomer Keren 2018-12-27 18:18:52 +02:00
parent 8c9c462154
commit 08492ee857

View file

@ -28,12 +28,14 @@ NOQA_INLINE_REGEXP = re.compile(
# ``# noqa``
# ``# noqa: E123``
# ``# noqa: E123,W451,F921``
# ``# noqa:E123,W451,F921``
# ``# NoQA: E123,W451,F921``
# ``# NOQA: E123,W451,F921``
# ``# NOQA: E123,W451,F921``
# 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]+)?)+))?",
r"# noqa(?::[\s]?(?P<codes>([A-Z][0-9]+(?:[,\s]+)?)+))?",
re.IGNORECASE,
)