plinss / flake8-noqa

flake8 plugin to validate #noqa comments - Mirror of https://gitlab.linss.com/open-source/flake8/flake8-noqa
GNU Lesser General Public License v3.0
41 stars 6 forks source link

multiline string with trailing comma causes false positive #15

Closed jkittner closed 2 years ago

jkittner commented 2 years ago

Having a multiline string as a positional argument inside a call with a trailing comma causes a false positive

call(
    '''\
    This super, long, long, long, long, long, long, long line is a false positive, the noqa does something!
    ''',  # noqa: E501
)

causes:

flake8 tt.py
tt.py:1:1: F821 undefined name 'call'
tt.py:4:11: NQA102 "# noqa: E501" has no matching violations

however when removing the noqa:

call(
    '''\
    This super, long, long, long, long, long, long, lon line is a false positive, the noqa does something
    ''',
)

it yields:

flake8 tt.py
tt.py:1:1: F821 undefined name 'call'
tt.py:3:80: E501 line too long (105 > 79 characters)

removing the trailing comma fixes the false positive.