Pylint Per-File Ignores Plugin

3.2.1 · active · verified Tue Apr 14

A Pylint plugin designed to enable granular control over Pylint error codes, allowing specific messages to be ignored per file or directory pattern. It provides a flexible alternative to littering code with `# pylint: disable` comments. This library is actively maintained, with its current version being 3.2.1.

Warnings

Install

Imports

Quickstart

To quickly enable `pylint-per-file-ignores`, first install it, then add `pylint_per_file_ignores` to the `load-plugins` section of your Pylint configuration (e.g., `pyproject.toml`, `.pylintrc`, or `setup.cfg`). Finally, define your file patterns and corresponding ignored message codes under the `per-file-ignores` section. This example uses `pyproject.toml`.

# pyproject.toml
[tool.pylint.main]
load-plugins = [
    "pylint_per_file_ignores",
]

[tool.pylint.'messages control']
per-file-ignores = [
    "/tests/*:missing-function-docstring,C0115",
    "/src/legacy_code.py:W0621,W0240,E0001"
]

view raw JSON →