Pylint

From XennisWiki
Jump to: navigation, search

Pylint is a source-code, bug and quality checker for the Python programming language. It follows the style recommended by PEP 8, the Python style guide. (Wikipedia)

Installation

Use pip to install it

pip install pylint

Configuration file

Generate a configuration file

pylint --generate-rcfile > .pylintrc

Write a custom configuration file .pylintrc

[FORMAT]

# Maximum number of characters on a single line.
max-line-length=120

[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s)
disable=missing-docstring

Usage

Run the linter

Call the linter on all *.py files

pylint *.py

Run the linter on several modules

pylint my_module/ another_module/

Disable a warning

Add a comment with the name of the warning, that should be disabled. For example

# pylint: disable=no-self-use

See also

External links