Skip to main content

GitLab-CQ

Parse linter output and convert it to GitLab Code Quality report.

Supported Linters

Pull Requests for additional linter support are welcome.

Installation

$ python -m pip install -U gitlab-cq

Or use pipx:

$ pipx install gitlab-cq

Usage

There are two ways to use GitLab-CQ: run linter command via. GitLab-CQ or parse linter output from stdin.

Run linter command via. GitLab-CQ:

$ gitlab-cq [--output file_path] [--merge] [--echo] CMD [Arguments]

Parse linter output from stdin:

$ CMD [Arguments] | gitlab-cq [--output file_path] [--merge] [--echo] LINTER

Arguments:

  • CMD:
    • Command to run linter.
  • Arguments:
    • Arguments for linter command.
  • LINTER:
    • Linter name to parse: {ruff, pyright, mypy, gcc, clang-tidy, clang}

Options:

  • --output file_path:
    • Output to file_path.
  • --merge:
    • Merge output to existing JSON file (available if --output is specified).
  • --echo:
    • Echo linter output (available if --output is specified).

Required options for linters

The following options are required for linters when parsing from stdin.
(No need to add the following when the linter runs via. GitLab-CQ, since these options are automatically added.)

  • ruff:
    • --output-format json is required and do not pass --output option.
  • pyright:
    • --outputjson is required.
  • mypy:
    • --output=json is required.

Example

Integration to GitLab CI and save an GitLab CQ artifact:

code quality:
  stage: test
  script:
    # Run linters via. GitLab-CQ and merge output to gl-code-quality-report.json
    - pipx install gitlab-cq
    - gitlab-cq --output gl-code-quality-report.json         ruff check .
    - gitlab-cq --output gl-code-quality-report.json --merge pyright .
    - gitlab-cq --output gl-code-quality-report.json --merge mypy .
    # Parse linter/compiler output and merge to gl-code-quality-report.json
    - gcc -Wall -Wextra -o /dev/null -c main.c 2>&1     | gitlab-cq --output gl-code-quality-report.json --merge gcc
    - clang-tidy -format-style=file -p . --quiet main.c | gitlab-cq --output gl-code-quality-report.json --merge clang-tidy  
  artifacts:
    reports:
      codequality: gl-code-quality-report.json

Author

Yoshiki Matsuda (@yosh-matsuda)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitlab_cq-0.2.2.tar.gz (14.0 kB view details)

Uploaded Source

File details

Details for the file gitlab_cq-0.2.2.tar.gz.

File metadata

  • Download URL: gitlab_cq-0.2.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gitlab_cq-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d688c2aea85cdbb2293cbff3d074bdf26c4ea30c8b02cff23384011dac26c791
MD5 061a576909849434f8fc94b13257f992
BLAKE2b-256 447b28d62ca9cec9eececb1efb58e98c0cbd108d8939c30d76df06317e4e4901

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.2 This release

1 file

0.2.1

2 files

0.2.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page