pylint之代码静态检查

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pylint之代码静态检查相关的知识,希望对你有一定的参考价值。


Pylint 是一个 Python 代码分析工具,它分析 Python 代码中的错误,查找不符合代码风格标准(Pylint 默认使用的代码风格是 PEP 8,具体信息,请参阅参考资料)和有潜在问题的代码。目前 Pylint 的最新版本是 pylint-0.18.1。 

Pylint 是一个 Python 工具,除了平常代码分析工具的作用之外,它提供了更多的功能:如检查一行代码的长度,变量名是否符合命名标准,一个声明过的接口是否被真正实现等等。 
Pylint 的一个很大的好处是它的高可配置性,高可定制性,并且可以很容易写小插件来添加功能。


Pylint is a tool that checks for errors in Python code, tries to enforce a coding standard and looks for code smells. It can also look for certain type errors, it can recommend suggestions about how particular blocks can be refactored and can offer you details about the code’s complexity.

Other similar projects would include the now defunct pycheckerpyflakesflake8 and mypy. The default coding style used by Pylint is close to PEP 008.

Pylint will display a number of messages as it analyzes the code and it can also be used for displaying some statistics about the number of warnings and errors found in different files. The messages are classified under various categories such as errors and warnings.

Last but not least, the code is given an overall mark, based on the number and severity of the warnings and errors.






Pylint

https://www.pylint.org/



https://pylint.readthedocs.io/en/latest/















http://www.jb51.net/article/31185.htm










用 Python 编写干净、可测试、高质量的代码

https://www.ibm.com/developerworks/cn/aix/library/au-cleancode/index.html


本文出自 “运维自动化” 博客,请务必保留此出处http://shower.blog.51cto.com/4926872/1971153

以上是关于pylint之代码静态检查的主要内容,如果未能解决你的问题,请参考以下文章

Python 进阶 — Flake8 静态代码检查工具

Python 进阶 — Flake8 静态代码检查工具

pycharm中设置pylint工具

python语法检查工具

VS Code报错Module 'xx' has no 'xx' member pylint(no-member)解决办法

2.3 代码静态分析和代码性能分析