[英]Enable all warnings in Flake8?
I am using flake8
(from tox
or from Makefile
).我正在使用
flake8
(来自tox
或来自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.然后我很惊讶
Pycharm
IDE 向我展示了大量的样式警告,而flake8
还没有抱怨过。 These are naming styles and more interesting things like class member initialization outside of __init__
.这些是命名风格和更有趣的事情,比如
__init__
之外的类成员初始化。 Pycharm is also using only Pep8 checks, to my understanding.据我了解,Pycharm 也仅使用 Pep8 检查。
How can I get flake8
to be extremely strict?我怎样才能让
flake8
变得非常严格? I tried strict=1
in the tox.ini
, or ignore=
, but nothing got me more than whitespace warnings.我在
tox.ini
尝试了strict=1
或ignore=
,但没有什么比空格警告更能tox.ini
我。
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.正如 Anthony 在评论中所说,您可以向 flake8 添加插件以合并不同的静态代码检查 - 有关如何执行此操作的完整详细信息,请参阅
flake8
的说明。
If the plugin is in PyPi, you can simply install using pip
and it should be good to go:如果插件在 PyPi 中,你可以简单地使用
pip
安装,它应该很好:
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.从这篇博客文章中提取的有用插件的一些示例是
flake8-import-order
,它会检查您的import
是否正确排序和flake8-builtins
,它检查您没有通过重新定义隐藏任何内置变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.