@codacy/tools-pylint-3
v0.2.0
Published
Pylint adapter — CLI-mode Python linter
Downloads
253
Readme
@codacy/tools-pylint-3
Table of Contents
Overview
Python static analyzer using the Pylint binary. Uses the CLI execution strategy — installs pylint into a dedicated venv, spawns it via spawnTool(), and parses its JSON2 output.
| Property | Value |
|----------|-------|
| Tool ID | PyLintPython3 |
| Codacy UUID | 31677b6d-4ae0-4f56-8041-606a8d7a8e61 |
| Strategy | CLI |
| Languages | Python |
| Binary | pylint |
| File patterns | **/*.py |
| Pattern count | ~340 |
| Prerequisites | Python 3.8+ |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonPattern IDs follow the format PyLintPython3_C0114, PyLintPython3_E0602, etc.
Updating the Pylint version
- Update
PREFERRED_VERSIONand thepylint==X.Y.Zentry inPIP_PACKAGESinsrc/adapter.ts - Run
pnpm prefetchto check for new/removed rules - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
pylint-4/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (requires pylint in PATH or auto-installed)Install pylint manually for local development:
pip install pylintOr let the adapter auto-install into a venv:
codacy-analysis analyze . --install-dependenciesThe adapter installs these packages into the venv:
pylint==3.3.9pylint-djangopylint-flaskpylint-celerypylint-commonpylint-beampylint-pytestSaltPyLint
Notes for maintainers
- JSON2 output format: The adapter uses
--output-format=json2which outputs{ "messages": [...], "statistics": {...} }. This is the modern format (Pylint 3.x+). - 0-based columns: Pylint reports columns as 0-based. The adapter adds 1 to convert to the 1-based model used by Codacy.
- Nullable endLine/endColumn: These fields can be
nullin Pylint output. The adapter omits them from Issue objects when null. - Exit code bitmask: Pylint uses a bitmask exit code. Bit 5 (value 32) indicates a usage error (bad config/args). Bits 0-4 (values 1-31) indicate normal findings. The adapter checks
exitCode & 32to distinguish errors from normal findings. - E0401 filtering: The
E0401(import-error) pattern is permanently filtered because sandboxed environments cannot resolve third-party imports. This matches the existing Codacy wrapper behavior. - Plugin support: The adapter bundles the same plugins as the Codacy wrapper (pylint-django, pylint-flask, pylint-celery, pylint-common, pylint-beam, pylint-pytest, SaltPyLint).
- Pattern parameters: Some patterns accept parameters (e.g.
max-line-lengthfor C0301,max-localsfor R0914). These are passed as--{param}={value}CLI arguments. - Venv isolation: Pylint and its plugins are installed in a dedicated venv at
~/.codacy/runtimes/pylint-3/venv/to avoid dependency conflicts with other Python tools. - Config files: The adapter checks for
pylintrc,.pylintrc,pylintrc.toml,.pylintrc.toml,pyproject.toml, andsetup.cfgin that order.
