Skip to main content

GitLab CI PyPI - Python Version PyPI - License PyPI PyPI - Downloads

pydocstyle-gitlab-code-quality

Generate GitLab Code Quality report from an output of pydocstyle.

Usage

# passing pydocstyle output through stdin (output printed to stdout)
pydocstyle main.py | pydocstyle-gitlab-code-quality > codequality.json
# or
pydocstyle-gitlab-code-quality < pydocstyle_out.txt > codequality.json

# using CLI flags (output printed directly to a file)
pydocstyle-gitlab-code-quality --input pydocstyle_out.txt --output codequality.json

CLI configuration

pydocstyle-gitlab-code-quality allows for the following CLI arguments:

flag example default description
--minor <CODE>... --minor=D100,D101 empty Error codes to be displayed with MINOR severity.
--major <CODE>... --major=D102,D103 empty Error codes to be displayed with MAJOR severity.
--critical <CODE>... --critical=D104,D105 empty Error codes to be displayed with CRITICAL severity.
-i, --ignore <CODE>... --ignore=D106,D107 empty Error codes to be omitted from Code Quality report.
-f, --file, --input <FILE> -f pydocstyle_out.txt empty Path to the file with pydocstyle output.
-o, --output <FILE> -o codequality.json empty Path to the file where the Code Quality report will be saved.
--no-stdout N/A False Do not print the Code Quality report to stdout.
--log-file <FILE> --log-file latest.log pgcq_latest.log Path to the file where the log will be saved.
--enable-logging N/A False Enable logging to a file. For debugging purposes only.

By default, all error codes are reported with INFO severity.

In case the same error code from pydocstyle has been provided to many severity options, the highest severity level takes precedence.

Example .gitlab-ci.yml file

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
    - pydocstyle-gitlab-code-quality --input pydocstyle-out.txt --output 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.

Metadata

Release files for pydocstyle-gitlab-code-quality 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydocstyle-gitlab-code-quality 0.1.0
File Size Uploaded
pydocstyle-gitlab-code-quality-0.1.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydocstyle-gitlab-code-quality 0.1.0
File Interpreter ABI Platform
pydocstyle_gitlab_code_quality-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / pydocstyle-gitlab-code-quality-0.1.0.tar.gz

Download URL pydocstyle-gitlab-code-quality-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7f84e756e77c8a6d0aa03e0c751e646578e2ad7e341652117654b89bf210e0cb
BLAKE2b-256 checksum
How to use checksums
ea30e0847112a3d1df61a14dd3e5e1f26d1b9bd17818f86fb40ed31ebc427ef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / pydocstyle_gitlab_code_quality-0.1.0-py3-none-any.whl

Download URL pydocstyle_gitlab_code_quality-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
567e81245e88035207f5025d31d80ce8a20aeb6c575ace46e7f5c8b0fb84c851
BLAKE2b-256 checksum
How to use checksums
39df1d7f158fc0e2e9d326f2fc93f45b4c4257a0ee1cd2d35e6666e4a6e6c1cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page