Pylint

Pylint is a static code analyzer for Python. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored.

Install

Install perflint alongside Pylint to identify performance issues.

pip install pylint perflint

Configure

Generate an example Pylint configuration file.

pylint --generate-rcfile > .pylintrc

Develop

Ignore specific warnings for a line of code.

some_code_that_triggers_warning = 42  # pylint: disable=duplicate-code

Ignore specific warnings for a block of code.

# pylint: disable=duplicate-code,unused-variable
def some_function(variable: str):
	print("This code might be similar to code elsewhere")
# pylint: enable=duplicate-code,unused-variable

Run

pylint ${SRC_DIR} --load-plugins perflint
Pylint
Interactive graph
On this page
Install
Configure
Develop
Run