It looks like when a decorator is added, flake8+darglint report the line number off by +1 so the line checked for noqa is shifted. Of the three methods below, the middle one reports linting errors
"""Test darglint with decorators."""
class C:
"""Example class with a decorated method."""
def foo2(self, arg1, arg2): # (Line 7)
"""Works as expected.""" # noqa: DAR101,DAR201
return f'{arg1}-{arg2}'
@staticmethod
def foo_static(arg1, arg2): # (Line 12)
"""Does not ignore the DAR101 and DAR201 errors.""" # noqa: DAR101,DAR201
return f'{arg1}-{arg2}'
@staticmethod
def foo_static_alt(arg1, arg2): # (Line 17)
"""Ignores the DAR101 and DAR201 errors."""
return f'{arg1}-{arg2}' # noqa: DAR101,DAR201
I am wondering if the root cause might be something like this: https://stackoverflow.com/a/47584560 ...
I might have a look myself, but thats unlikely that I will get around to it.
It looks like when a decorator is added, flake8+darglint report the line number off by +1 so the line checked for noqa is shifted. Of the three methods below, the middle one reports linting errors
However,
darglint
appears to get the line number correct before the flake8-integrationPossibly related to #21