smarkets / flake8-strict

Flake8 plugin that checks Python code against a set of opinionated style rules
MIT License
10 stars 8 forks source link

S100 and S101 false negatives for function called inside instance method #36

Closed mxr closed 6 years ago

mxr commented 6 years ago

The following code does not give S100 or S101 errors:

def func(a, b, c, d, e):
    print(a, b, c, d, e)

class Foo(object):
    def bar(self):
        func(1, 2, 3,
             4, 5)

If I move the function out of the class, then I get the expected errors:

def func(a, b, c, d, e):
    print(a, b, c, d, e)

def bar():
    func(1, 2, 3,
         4, 5)
$ flake8 ~/tmp/example.py
/Users/maxr/tmp/example.py:6:10: S100 First argument on the same line
/Users/maxr/tmp/example.py:7:13: S101 Multi-line construct missing trailing comma

My env:

$ flake8 --version
3.5.0 (flake8-tidy-imports: 1.1.0, flake8_strict: 0.1.8, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 2.7.13 on Darwin