Skip to content

soul-catcher/mypy-gitlab-code-quality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab-CI PyPI - Python Version PyPI Downloads PyPI - License Ruff

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 widget

Usage

$ mypy program.py | mypy-gitlab-code-quality

This command send to STDOUT generated json that can be used as Code Quality report artifact.

Example .gitlab-ci.yml

image: python:alpine
codequality:
  script:
    - pip install mypy mypy-gitlab-code-quality
    - mypy program.py --no-pretty > mypy-out.txt || true  # "|| true" is used for preventing job fail when mypy find errors
    - mypy-gitlab-code-quality < mypy-out.txt > codequality.json
  artifacts:
    when: always
    reports:
      codequality: codequality.json

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
mypy .
ruff check
ruff format

Suggestions and merge requests are always welcome :)