简体   繁体   中英

Enable all warnings in Flake8?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM