flake8-super-call
is a Flake8 extension that
checks Python methods for anti-pattern super
calls.
When calling super
in a derived class, passing self.__class__
to super()
can give the wrong starting point
to search for methods, and will end up calling its own method again. More details on this Stack Overflow question.
Install from PyPI using pip
:
$ pip install flake8-super-call
The extension will be activated automatically by flake8
. You can verify
that it has been loaded by inspecting the flake8 --version
:
$ flake8 --version
3.5.0 (flake8_super_call: 1.0.0, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0) CPython 2.7.10 on Darwin
This extension adds one new error code:
S777
: Cannot useself.__class__
as first argument ofsuper()
call