Skip to content

Latest commit

 

History

103 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyright to gitlab

PyPI version Python versions License: MIT Code style: ruff Typing: typed

Simple Python tool to convert Pyright JSON output to GitLab Code Quality report format.

Zero runtime dependencies - Pure Python implementation using only the standard library.

Install

You can install the package from PyPI using pip:

pip install pyright-to-gitlab

Or make it available globally:

  • via pipx:
    pipx install pyright-to-gitlab
  • via uv:
    uv tool install pyright-to-gitlab

As a one-time use, you can also run it directly with uvx:

uvx pyright-to-gitlab --help

Or download the single source file and run it with Python:

wget https://raw.githubusercontent.com/schollm/pyright-to-gitlab/refs/heads/main/src/pyright_to_gitlab.py -O pyright_to_gitlab.py
python pyright_to_gitlab.py --help

Usage

pyright-to-gitlab --help

Output:

usage: pyright-to-gitlab [-h] [-i INPUT] [-o OUTPUT] [--prefix PATH_PREFIX] [--version]

Convert Pyright JSON output to a GitLab Code Quality report.

Input defaults to stdin and output defaults to stdout.
Use '-' explicitly for stdin/stdout when mixing with file paths.

options:
  -h, --help            show this help message and exit
  -i, --input INPUT     Path to Pyright JSON input (default: -). Use - to read from stdin.
  -o, --output OUTPUT   Path for GitLab Code Quality JSON (default: -). Use - to write to stdout.
  --prefix PATH_PREFIX  Prefix added to each reported file path, e.g. 'backend/' for monorepos.
  --version             show program's version number and exit

Examples:
  pyright . --outputjson | pyright-to-gitlab > gl-code-quality.json
  pyright-to-gitlab -i pyright.json -o gl-code-quality.json
  pyright-to-gitlab --prefix backend/ -i pyright.json -o -
  pyright-to-gitlab -i pyright.json

Convert from stdin to stdout (typical pipeline):

pyright . --outputjson | pyright-to-gitlab > code-quality.json

Convert from file to file:

pyright-to-gitlab -i pyright.json -o code-quality.json

Run as a module:

pyright . --outputjson | python -m pyright_to_gitlab > code-quality.json

Custom path prefix

The --prefix option adds a custom prefix path to the file paths in the output. This is useful for mono-repos, where the paths in the pyright output are not the repository root.

pyright . --outputjson | pyright-to-gitlab --prefix my-app > code-quality.json

Development

Testing

To run the tests, execute

uv run poe check

About

Pyright json to gitlab code quality report

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages