{"id":6056,"library":"pylint-per-file-ignores","title":"Pylint Per-File Ignores Plugin","description":"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.","status":"active","version":"3.2.1","language":"en","source_language":"en","source_url":"https://github.com/kasium/pylint-per-file-ignores","tags":["pylint","linter","code quality","plugin","configuration","ignore"],"install":[{"cmd":"pip install pylint-per-file-ignores","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This is a plugin for Pylint and requires Pylint to function.","package":"pylint"},{"reason":"Requires Python versions >=3.10 and <4 for compatibility.","package":"python","optional":false}],"imports":[{"note":"The plugin extends Pylint's functionality at runtime through configuration, it does not expose Python symbols for direct import into user scripts.","wrong":"from pylint_per_file_ignores import some_function","symbol":"pylint_per_file_ignores","correct":"This plugin is loaded via Pylint's configuration, not directly imported into Python code. Add 'pylint_per_file_ignores' to the 'load-plugins' list in your Pylint configuration file."}],"quickstart":{"code":"# pyproject.toml\n[tool.pylint.main]\nload-plugins = [\n    \"pylint_per_file_ignores\",\n]\n\n[tool.pylint.'messages control']\nper-file-ignores = [\n    \"/tests/*:missing-function-docstring,C0115\",\n    \"/src/legacy_code.py:W0621,W0240,E0001\"\n]","lang":"toml","description":"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`."},"warnings":[{"fix":"Review all `per-file-ignores` patterns in your Pylint configuration and convert any regex patterns to glob patterns if upgrading to v2.0.0 or newer. For example, a regex `.*_test\\.py` might become a glob `*_test.py` or `/tests/*.py`.","message":"Prior to version 2.0.0, file patterns used regular expressions. From version 2.0.0 onwards, patterns are matched using globs. Existing configurations from older versions must be reviewed and updated to use glob syntax.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Ensure the plugin is activated by correctly adding `pylint_per_file_ignores` to the `load-plugins` list within your chosen Pylint configuration file, and define ignore rules in the designated `per-file-ignores` section.","message":"The plugin is enabled and configured via Pylint's configuration files (e.g., `pyproject.toml`, `.pylintrc`, `setup.cfg`) by adding it to `load-plugins` and defining rules under `per-file-ignores`. It's not a Python module meant for `import` statements in your code.","severity":"gotcha","affected_versions":"All"},{"fix":"Leverage `pylint-per-file-ignores` for granular control over file and directory patterns. Ensure your `load-plugins` is correctly configured so the plugin can intercept and apply ignore rules before Pylint processes files.","message":"Pylint's native `--ignore` option might not work as expected with directories, especially when Pylint is invoked on individual files (e.g., by pre-commit hooks or IDEs). This plugin specifically addresses per-file/pattern ignoring when `--ignore` falls short.","severity":"gotcha","affected_versions":"Pylint < 2.9 (native --ignore limitations)"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}