I am using flake8
(from tox
or from Makefile
). It basically gave me warnings about whitespaces and I got my codebase clean, so I though.
I was then surprised that Pycharm
IDE displayed me a ton of style warnings, which flake8
hadn't complained about yet. These are naming styles and more interesting things like class member initialization outside of __init__
. Pycharm is also using only Pep8 checks, to my understanding.
How can I get flake8
to be extremely strict? I tried strict=1
in the tox.ini
, or ignore=
, but nothing got me more than whitespace warnings.
As Anthony said in the comments, you can add plugins to flake8 in order to incorporate different static code checks - see the instructions from flake8
for full details on how to do this.
If the plugin is in PyPi, you can simply install using pip
and it should be good to go:
pip install <plugin-name>
Some examples of useful plugins, extracted from this blog post, are flake8-import-order
, which will check that your import
s are ordered correctly and flake8-builtins
, which checks that you are not hiding any builtin variables by re-defining them.