Simple script to generate gitlab code quality report from output of mypy.
Project description
mypy-gitlab-code-quality
Simple script to generate gitlab code quality report from output of mypy.
Example gitlab codequality report from gitlab documentation:
Usage
$ mypy program.py | PYTHONHASHSEED=0 mypy-gitlab-code-quality
This command send to STDOUT
generated json that can be used as Code Quality report artifact.
Note: Set environment variable PYTHONHASHSEED
to 0
to prevent randomize hashes.
Constant hashes allow gitlab to determine diff between branches on merge request.
Example .gitlab-ci.yml
image: python:alpine
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/
- venv/
- .mypy_cache/
before_script:
- python --version # For debugging
- python -m venv venv
- . venv/bin/activate
codequality:
script:
- pip install mypy mypy-gitlab-code-quality
- mypy program.py --no-error-summary > mypy-out.txt
- PYTHONHASHSEED=0 mypy-gitlab-code-quality < mypy-out.txt > codequality.json
artifacts:
when: always
reports:
codequality: codequality.json
allow_failure: true
Note: if you want to use this example you should replace program.py
with yours module names.
Contributing
Please run linters before creating merge request
pip install requirements/dev.txt
black .
mypy .
ruff .
Suggestions and merge requests are always welcome :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mypy-gitlab-code-quality-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64b9a5ad340740b694ee3b04ee9691c58244413bafa485fbe7d9632f5b3dd654 |
|
MD5 | 7a2a53ec085bf93f9228a5d196a1f3ee |
|
BLAKE2b-256 | 2d435f3cc26f028da7cf30eba5b7fd3554183f8c1638dbb0c5e38d0d25292768 |
Hashes for mypy_gitlab_code_quality-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a8c55f8c83d95890cdf5e78b9d8a90629658bc63cba5df7ab56f63828a55538 |
|
MD5 | 77b2e77c20e7ae2cb2569d72d61c6485 |
|
BLAKE2b-256 | c4d8129c340a4d51f1a622b98cd310d14854c3bae86b9a1f0ce28c5622ac4257 |