1. 程式人生 > >pylint之代碼靜態檢查

pylint之代碼靜態檢查

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 pychecker, pyflakes, flake8 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之代碼靜態檢查