{"id":5698,"library":"pylint-gitlab","title":"pylint-gitlab","description":"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.","status":"active","version":"2.1.1","language":"en","source_language":"en","source_url":"https://github.com/thomass/pylint-gitlab","tags":["pylint","gitlab","ci","code-quality","linter","formatter","python"],"install":[{"cmd":"pip install pylint-gitlab","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for linting; pylint-gitlab provides formatters for its output.","package":"pylint","optional":false}],"imports":[{"note":"Used with '--output-format=pylint_gitlab.GitlabCodeClimateReporter' or '--load-plugins=pylint_gitlab --output-format=gitlab-codeclimate'.","symbol":"GitlabCodeClimateReporter","correct":"from pylint_gitlab import GitlabCodeClimateReporter"},{"note":"Used with '--output-format=pylint_gitlab.GitlabPagesHtmlReporter' or '--load-plugins=pylint_gitlab --output-format=gitlab-pages-html'.","symbol":"GitlabPagesHtmlReporter","correct":"from pylint_gitlab import GitlabPagesHtmlReporter"}],"quickstart":{"code":"# .gitlab-ci.yml\nimage: python:3.9-slim\n\npylint_job:\n  stage: test\n  before_script:\n    - pip install pylint-gitlab\n    - mkdir -p public # For HTML report if used\n  script:\n    - |-\n      # Create a dummy Python file to lint\n      echo \"def func():\\n  x = 1\\n  return x\" > my_module.py\n      # Run pylint with the GitLab Code Climate reporter\n      pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter my_module.py > codeclimate.json\n  artifacts:\n    reports:\n      codequality: codeclimate.json\n","lang":"yaml","description":"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."},"warnings":[{"fix":"Consider migrating to 'ruff' which has built-in support for GitLab Code Quality reports. Refer to 'ruff' official documentation for migration guidance.","message":"The 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.","severity":"breaking","affected_versions":"All versions (project archived)"},{"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.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Using `--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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"For 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Pylint (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).","severity":"gotcha","affected_versions":"pylint-gitlab versions using Pylint 3.x"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}