This is the docker engine we use at Codacy to have Pylint support. You can also create a docker to integrate the tool and language of your choice! See the codacy-engine-scala-seed repository for more information.
You can create the docker by doing:
docker build -t codacy-pylint-python3:latest .The docker is ran with the following command:
docker run -it -v $srcDir:/src codacy-pylint-python3:latest- Update the version in
docs/patterns.json - Run the DocGenerator:
sbt "doc-generator/run"We use the codacy-plugins-test to test our external tools integration. You can follow the instructions there to make sure your tool is working as expected.
This section is written for an AI coding agent (or a human) tasked with updating this repo — most commonly bumping the wrapped Pylint version, but also base image / dependency bumps. Follow it top to bottom; it tells you what to change, how to regenerate derived files, how to test locally, and how to interpret CI so you can iterate on failures without guessing.
This is a Codacy engine: a small Python program (src/codacy_pylint.py, run directly as the Docker ENTRYPOINT/CMD — there is no Scala runtime engine class here) that packages Pylint as a Docker image Codacy's platform can run against a customer's Python source code. Dependencies (pylint, Django/Flask plugins used to exercise framework-aware checks, etc.) are installed via pip from requirements.txt into a python:3.14-alpine3.23 base image (see Dockerfile).
There is a separate, small Scala/sbt subproject (doc-generator/, built with sbt 1.11.6 per project/build.properties) whose only job is to regenerate the docs/ directory — it is not part of the shipped engine image. docs/ is machine-consumed configuration, not just documentation:
docs/patterns.json— the full list of Pylint rules ("patterns") Codacy knows about, their category/level/parameters/defaults, and which are enabled out of the box. Generated file, do not hand-edit.docs/description/description.json+docs/description/*.md— human-readable titles/descriptions per pattern, used in the Codacy UI. Generated file, do not hand-edit.docs/tests/*.pyanddocs/multiple-tests/*— fixtures used bycodacy-plugins-testto validate the engine actually produces the results it claims to for real code samples.docs/tool-description.md— short blurb about the tool, hand-maintained.
All three generated artifacts above come from doc-generator/src/main/scala/codacy/pylint/Main.scala, which reads the pinned pylint==<version> from requirements.txt, then scrapes https://pylint.pycqa.org/en/v<version>/user_guide/checkers/features.html (via scala-scraper) for the rule list and converts each rule's HTML description to Markdown via pandoc. This means the generator needs network access, and pandoc installed locally (it also hardcodes a small blacklist of rules, a set of "enabled by default" pattern IDs, and per-rule parameter definitions directly in the Scala source — review these when rules are added/removed/renamed upstream).
| File | What it controls | What to check |
|---|---|---|
requirements.txt → pylint== |
The Pylint release bundled in the image, and the exact version doc-generator/Main.scala scrapes docs for |
Bump to the target version. Confirm https://pylint.pycqa.org/en/v<version>/user_guide/checkers/features.html exists upstream before regenerating docs. |
requirements.txt → Django==, Flask==, pylint-django==, jsonpickle==, asttokens==, etc. |
Framework/runtime deps used by the plugin checkers and by codacy_pylint.py itself |
Prior bump commits (e.g. fa898a0, the bump-pylint-v4 PR) bump these alongside pylint in the same commit — check for newer compatible releases and CVEs (dependabot also opens PRs for these individually). |
Dockerfile → base image (python:3.14-alpine3.23) |
Python runtime/OS the packaged app runs on | Historically bumped in lockstep with the pylint version (see git history) even when not strictly required — verify the new Pylint version still supports the Python version in the base image. |
.circleci/config.yml → codacy/base orb, codacy/plugins-test orb |
Shared CircleCI steps (checkout/version, sbt build, docker build/publish, tagging) and the codacy-plugins-test runner |
Check the latest published orb versions; not usually tied to a Pylint bump specifically. |
project/build.properties / project/plugins.sbt |
sbt version / codacy-sbt-plugin version used only to build doc-generator |
Rarely needs touching; check only if the doc-generator build itself fails to load. |
src/codacy_pylint.py |
Engine glue code (reads Codacy's config JSON, builds the pylintrc, invokes pylint) |
Not version-pinned, but past bumps have needed small compatibility fixes here (e.g. e5b9687 changed a 'patterns' in tools[0] truthiness check) when the upstream config-reading contract shifted — read it and diff behavior if the new Pylint version changes CLI/config semantics. |
- Bump
pylint==(and compatible companion packages) inrequirements.txt, and the base image tag inDockerfileif warranted. - Regenerate the docs. Requires
pandoconPATHand network access:sbt "doc-generator/run". This overwritesdocs/patterns.jsonanddocs/description/*; review the diff for new/removed/renamed rules, changed defaults, and stale fixtures underdocs/tests//docs/multiple-tests/. - Format/compile the Scala doc-generator if you touched
Main.scala:sbt "scalafmt::test; sbt:scalafmt::test"(CI jobcheck_scalafmtruns this). - Build the Docker image and run the built-in smoke test:
docker build -t codacy-pylint-python3:latest . && docker run --rm codacy-pylint-python3:latest codacy_pylint_test.py. - Run
codacy-plugins-testlocally before pushing — clone https://github.com/codacy/codacy-plugins-test and run its DockerTest commands (this repo's CI runs it withrun_multiple_tests: true, i.e. both the single-pattern tests underdocs/tests/and thedocs/multiple-tests/*scenarios) against your local image tag. - Iterate on failures, re-running only the relevant test command after each fix.
- Commit the version bump(s) together with the regenerated
docs/files (and anysrc/codacy_pylint.pycompatibility fixes) in one change. - Push and open a PR. CI (
.circleci/config.yml) runscheckout_and_version->check_scalafmt->generate_docs(regenerates docs in CI too, requires pandoc) ->build_docker_and_test->plugins_test->publish_docker(master only) ->tag_version. - Poll the PR's real CI checks until they all pass — local validation is NOT the finish line. After every push, run
gh pr checks <pr-url>and keep re-polling (short sleep while any check ispending) until all checks finish. If a check fails, fetch its actual log (the CircleCI job's log — don't guess), find the true root cause, fix it, push again (never--no-verify, never force-push), and re-poll. Repeat until every check is green. The CI environment's toolchain can differ from your local one (CI'sgenerate_docsjob re-scrapes Pylint's live docs site and re-runs pandoc — if that output differs from what you committed locally, the diff will show up as an unexpected change in a later job), so a clean local run does not guarantee CI passes. Only stop iterating when every check passes, or you hit a genuine product/infra decision that needs a human — in which case explain it in the PR rather than guessing.
| Symptom | Likely cause | Fix |
|---|---|---|
generate_docs / local sbt "doc-generator/run" produces a huge unrelated diff |
Pylint's docs site restructured its checker sections between versions | Compare #...-checker-messages anchor IDs in Main.scala against the new version's features.html; add/remove/rename anchors as needed |
codacy_pylint_test.py fails in build_docker_and_test |
Engine glue code assumption broken by the new Pylint CLI/config format | Diff Pylint's release notes for CLI/config changes; patch src/codacy_pylint.py accordingly (see the e5b9687 precedent) |
plugins_test fails on a specific fixture under docs/tests/ or docs/multiple-tests/ |
Rule renamed/removed/added upstream, or its message/output format changed | Regenerate docs, and update the expected fixture output to match the new (verified correct) behavior |
CI publish_docker/tag_version don't run on your branch |
Expected — gated to the default branch only | Nothing to fix |
- Version bump(s) reflected in all files that encode them (
requirements.txt,Dockerfile, and CI config if applicable). - Generated docs (
docs/patterns.json,docs/description/*) regenerated and committed, with fixture inconsistencies resolved. src/codacy_pylint.pyupdated if the new Pylint version changed CLI/config behavior it depends on.- Docker image builds successfully and the built-in
codacy_pylint_test.pysmoke test passes. codacy-plugins-testcommands all pass locally against the freshly built image.- After pushing and opening/updating the PR, every CI check on it is green. Poll
gh pr checks <pr-url>and iterate on any failure (fetch the real CI log, fix, push, re-poll) until all pass — a passing local build is not sufficient, because the CI toolchain can differ from your local one (see step 9).
Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.
- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories
Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.
Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.
Codacy is free for Open Source projects.