Skip to main content

Simple script to generate gitlab code quality report from output of mypy.

Project description

Gitlab-CI PyPI - Python Version PyPI PyPI - License

mypy-gitlab-code-quality

Simple script to generate gitlab code quality report from output of mypy.

Example gitlab codequality report from gitlab documentation: Example gitlab codequality report

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.

Project details


Download files

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

Source Distribution

mypy-gitlab-code-quality-0.0.11.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page