Registry / devops / pylint-gitlab

pylint-gitlab

JSON →
library2.1.1pypypi✓ verified 24d ago

pylint-gitlab provides custom Pylint formatters for seamless integration with GitLab CI/CD, enabling the generation of Code Quality reports and GitLab Pages HTML reports from Pylint's linting results. The current version is 2.1.1, released in November 2025, and the project has an active, though somewhat irregular, release cadence.

pip install pylint-gitlab
INSTALL
IMPORT
SIG · PYLINT-GITLAB
P
pylint-gitlab
devopspythonv2.1.1
Install
3.9s avg
Import
370ms
Disk
34MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.388s · 35MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.352s · 36MB
34MB installed
● package 34MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GitlabCodeClimateReporter
from pylint_gitlab import GitlabCodeClimateReporter
Used with '--output-format=pylint_gitlab.GitlabCodeClimateReporter' or '--load-plugins=pylint_gitlab --output-format=gitlab-codeclimate'.
GitlabPagesHtmlReporter
from pylint_gitlab import GitlabPagesHtmlReporter
Used with '--output-format=pylint_gitlab.GitlabPagesHtmlReporter' or '--load-plugins=pylint_gitlab --output-format=gitlab-pages-html'.

This GitLab CI/CD configuration demonstrates how to integrate `pylint-gitlab` into your pipeline. It installs the library, creates a dummy Python file with a simple linting issue, runs Pylint using the `GitlabCodeClimateReporter` to generate a `codeclimate.json` file, and then declares this file as a `codequality` artifact, which GitLab will parse to display code quality metrics in merge requests.

# .gitlab-ci.yml image: python:3.9-slim pylint_job: stage: test before_script: - pip install pylint-gitlab - mkdir -p public # For HTML report if used script: - |- # Create a dummy Python file to lint echo "def func():\n x = 1\n return x" > my_module.py # Run pylint with the GitLab Code Climate reporter pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter my_module.py > codeclimate.json artifacts: reports: codequality: codeclimate.json
pylint-gitlab --version
Debug
Known issues
breakingThe official GitHub repository for pylint-gitlab is archived, with a recommendation to migrate to 'ruff' for GitLab Code Quality reports. While the PyPI package still receives updates, active development for new features or bug fixes may be limited, and users are encouraged to evaluate 'ruff' as an alternative.
fix
Consider migrating to 'ruff' which has built-in support for GitLab Code Quality reports. Refer to 'ruff' official documentation for migration guidance.
affects: All versions (project archived)
gotchaWhen running Pylint in CI/CD, 'Unable to import' errors are common if Python dependencies are not properly installed or if the project's root is not on the `PYTHONPATH`. Pylint needs to correctly resolve imports to analyze code.
fix
Ensure all project dependencies are installed in the CI environment (e.g., using `pip install -r requirements.txt`). If your project structure involves custom import paths, add them to `sys.path` using `init-hook` in your `.pylintrc` or by manipulating `PYTHONPATH` in your CI script.
affects: All versions
gotchaUsing `--exit-zero` with Pylint in CI prevents the job from failing due to linting errors, allowing the Code Quality report to be generated even if issues are found. Without it, the CI job might fail prematurely, preventing the report from being processed by GitLab.
fix
Include `--exit-zero` in your Pylint command within the CI script (e.g., `pylint --exit-zero ...`) to ensure the job completes and generates the artifact. If you want the pipeline to fail on a specific Pylint score, configure GitLab CI/CD's quality gates or use a custom script to evaluate the Pylint score output.
affects: All versions
gotchaFor GitLab to display Code Quality results, the generated `codeclimate.json` file must be declared as a `codequality` report artifact in your `.gitlab-ci.yml` file. Failing to do so will result in the report not appearing in merge requests.
fix
Add an `artifacts` section to your CI job with `reports: codequality: codeclimate.json` (or your chosen output filename) to ensure the report is collected and processed by GitLab.
affects: All versions
gotchaPylint (a core dependency) has specific Python version requirements (e.g., Pylint 3.x generally requires Python 3.10+). Ensure that the Python version used in your CI environment is compatible with the version of Pylint being installed (which `pylint-gitlab` will pull as a dependency).
fix
Verify the Python version used in your CI image (e.g., `python:3.10-slim`) is compatible with the Pylint version implicitly or explicitly installed. Check Pylint's release notes for its minimum Python requirements.
affects: pylint-gitlab versions using Pylint 3.x
Errors
Common errors & fixes
pylint: command not found
The 'pylint' executable (and by extension, the 'pylint-gitlab' formatter) is not found in the system's PATH within the CI/CD environment, or it was not installed.
fix
Ensure `pylint` and `pylint-gitlab` are installed in your CI/CD environment (e.g., via `pip install pylint pylint-gitlab`). If using a virtual environment, make sure it's activated, or the full path to the executables is used.
E0401: Unable to import '...' (import-error) OR ModuleNotFoundError: No module named '...'
Pylint cannot locate the imported Python modules during its analysis, often because project dependencies are not installed in the CI environment or the Python path does not include your project's source directories.
fix
Install all project dependencies in your CI/CD job (e.g., `pip install -r requirements.txt`). Additionally, ensure that your project's root directory is added to Python's path before running Pylint, typically by setting `export PYTHONPATH=$PYTHONPATH:./src` (adjust `src` to your project's source directory) or running Pylint from the project's root.
Failed to load Code Quality report OR No Code Quality appears on merge requests (related to pylint_gitlab.GitlabCodeClimateReporter)
The Pylint output is not correctly formatted as a GitLab Code Quality (Code Climate) JSON report, the report file is not declared as a GitLab artifact, or the `pylint-gitlab` formatter is not correctly invoked.
fix
Run Pylint with the correct formatter and redirect output to the expected file. In your `.gitlab-ci.yml`, the script should look like: `pylint --output-format=pylint_gitlab.GitlabCodeClimateReporter > gl-code-quality-report.json`. Then, declare this file as a `codequality` artifact: `artifacts: reports: codequality: gl-code-quality-report.json`.
Upgrade
Version history
2.1.1latest on PyPI · released Nov 23, 2025
Audit
Dependencies
pylintrequiredCore dependency for linting; pylint-gitlab provides formatters for its output.
Agent activity
7 hits · last 30 days
node
6
Resources
pylint-gitlab — pip install pylint-gitlab · libregistry