Skip to content

DragosOprica/flake8-super-call

Repository files navigation

Flake8 super call Checker

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.

Installation

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

Error Codes

This extension adds one new error code:

  • S777: Cannot use self.__class__ as first argument of super() call

About

Flake8 extension that checks for bad super calls

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages