pydocstyle-gitlab-code-quality
Generate GitLab Code Quality report from an output of pydocstyle.
Usage
$ pydocstyle <file_path> | PYTHONHASHSEED=0 pydocstyle-gitlab-code-quality
The output of this command is printed to stdout
in JSON format, which can be used as Code Quality report.
Environment variable PYTHONHASHSEED=0
prevents randomized hashes, which are used by GitLab to determine changes between branches on merge request.
.gitlab-ci.yml
file
Example image: python:alpine
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
paths:
- .cache/pip/
- venv/
before_script:
- python --version # For debugging
- python -m venv venv
- . venv/bin/activate
codequality:
script:
- pip install pydocstyle pydocstyle-gitlab-code-quality
- pydocstyle program.py > pydocstyle-out.txt
- PYTHONHASHSEED=0 pydocstyle-gitlab-code-quality < pydocstyle-out.txt > codequality.json
artifacts:
when: always
reports:
codequality: codequality.json
allow_failure: true
Credits
This script was inspired by mypy-gitlab-code-quality. Thanks!
License
The project is licensed under MIT - a free and open-source license. For more information, please see the license file.