tags:
- python
- pylint
title: What is Pylint?
permalink: what-is-pylint
date created: Wednesday, October 2nd 2024, 3:17:59 pm
date modified: Thursday, May 15th 2025, 9:46:06 am
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 perflint alongside Pylint to identify performance issues.
pip install pylint perflint
Generate an example Pylint configuration file.
pylint --generate-rcfile > .pylintrc
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
pylint ${SRC_DIR} --load-plugins perflint