Pylint、PyChecker 还是 PyFlakes?
我想获得有关这些工具的一些反馈:
- 功能;
- 适应性;
- 易用性和学习曲线。
I would like to get some feedback on these tools on:
- features;
- adaptability;
- ease of use and learning curve.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我有点好奇,所以我在提出问题后就自己测试了这三个;-)
好吧,这不是一个非常严肃的评论,但我可以说的是:
我尝试了这些工具以下脚本的默认设置(这很重要,因为您几乎可以选择检查规则):
结果:
PyChecker
很麻烦,因为它编译模块来分析它。如果您不希望代码运行(例如,它执行 SQL 查询),那就不好了。PyFlakes
应该很轻。事实上,它认为代码是完美的。我正在寻找一些非常严重的东西,所以我认为我不会去做。PyLint
非常健谈,对代码的评分为 3/10(天啊,我是个肮脏的编码员!)。PyLint
的优点:Pylint 的缺点:
更正的脚本(带有惰性文档字符串和变量名称):
感谢 Rudiger Wolf ,我发现
pep8
的功能正如其名称所示:匹配 PEP8。它发现了一些 Pylint 没有发现的语法禁忌。但 Pylint 发现了一些与 PEP8 没有明确关联但很有趣的东西。这两种工具都很有趣并且互补。最终我将使用两者,因为它们确实很容易安装(通过包或安装工具)并且输出文本很容易链接。
让您了解一下它们的输出:
pep8:
Pylint:
Well, I am a bit curious, so I just tested the three myself right after asking the question ;-)
Ok, this is not a very serious review, but here is what I can say:
I tried the tools with the default settings (it's important because you can pretty much choose your check rules) on the following script:
As a result:
PyChecker
is troublesome because it compiles the module to analyze it. If you don't want your code to run (e.g, it performs a SQL query), that's bad.PyFlakes
is supposed to be light. Indeed, it decided that the code was perfect. I am looking for something quite severe so I don't think I'll go for it.PyLint
has been very talkative and rated the code 3/10 (OMG, I'm a dirty coder !).Strong points of
PyLint
:Cons of Pylint:
Corrected script (with lazy doc strings and variable names):
Thanks to Rudiger Wolf, I discovered
pep8
that does exactly what its name suggests: matching PEP8. It has found several syntax no-nos that Pylint did not. But Pylint found stuff that was not specifically linked to PEP8 but interesting. Both tools are interesting and complementary.Eventually I will use both since there are really easy to install (via packages or setuptools) and the output text is so easy to chain.
To give you a little idea of their output:
pep8:
Pylint:
pep8 最近已添加到 PyPi。
现在根据 pep8 检查您的代码非常容易。
请参阅http://pypi.python.org/pypi/pep8
pep8 was recently added to PyPi.
It is now super easy to check your code against pep8.
See http://pypi.python.org/pypi/pep8