一个Python源代码分析器:pylint

jopen 8年前

pylint是一个Python源代码分析器,用于查找编程错误,帮助强制执行编码标准和嗅探一段代码异味。

Pylint has many rules enabled by default, way too much to silence them all on a minimally sized program. It's highly configurable and handle pragmas to control it from within your code. Additionally, it is possible to write plugins to add your own checks.

It's a free software distributed under the GNU Public Licence.

Development is hosted on bitbucket: https://bitbucket.org/logilab/pylint/

You can use the code-quality@python.org mailing list to discuss about Pylint. Subscribe at https://mail.python.org/mailman/listinfo/code-quality/ or read the archives at https://mail.python.org/pipermail/code-quality/

Install

Pylint requires astroid package (the later the better).

Installation should be as simple as

python -m pip install astroid

If you want to install from a source distribution, extract the tarball and run the following commands

hg update master  python setup.py install

You'll have to install dependencies in a similar way. For debian and rpm packages, use your usual tools according to your Linux distribution.

More information about installation and available distribution format may be found in the user manual in the doc subdirectory.

Documentation

Look in the doc/ subdirectory or at http://docs.pylint.org

Pylint is shipped with following additional commands:

  • pyreverse: an UML diagram generator
  • symilar: an independent similarities checker
  • epylint: Emacs and Flymake compatible Pylint
  • pylint-gui: a graphical interface

项目主页:http://www.open-open.com/lib/view/home/1450170113203