Philip
Philip

Reputation: 1931

How can I get flake8 to catch this error?

On this test program:

def func():
    return 42

func(1, 2, 3)

pylint -E it says:

E1121: Too many positional arguments for function call (too-many-function-args)

But flake8 says no errors or warnings. This is a huge obvious error why does flake8 not catch this? Do I need certain flags?

pylint 2.5.2

flake8 3.8.2 (pyflakes 2.2.0)

Python 3.8.1 on Mac

Upvotes: 1

Views: 905

Answers (1)

Philip
Philip

Reputation: 1931

PyFlakes (that flake8 uses) does not do that type of checking.

I filed an issue with the PyFlakes project and received a quick response: "pyflakes works entirely statically and does not do any type analysis (it does not follow imports or function calls, etc.). this design is chosen to keep pyflakes fast and simple ... If you're looking for type analysis, you're best to use a type checker such as mypy or a tool like pylint."

I asked is the number of arguments really "type analysis" and they said "in python, the shape of a callable is its type (number of parameters, kwonly, posonly, defaulted, collecting, etc.)"

Upvotes: 4

Related Questions