This repository was archived by the owner on Nov 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +56
-1
lines changed Expand file tree Collapse file tree 1 file changed +56
-1
lines changed Original file line number Diff line number Diff line change 1
- # pydocstyle-gitlab-code-quality
1
+ ![ GitLab CI] ( https://img.shields.io/badge/GitLab%20CI-%23181717.svg?style=flat-square&logo=gitlab&logoColor=white )
2
+ ![ PyPI - Python Version] ( https://img.shields.io/pypi/pyversions/pydocstyle-gitlab-code-quality?style=flat-square )
3
+ [ ![ PyPI - License] ( https://img.shields.io/pypi/l/pydocstyle-gitlab-code-quality?style=flat-square )] ( LICENSE.md )
4
+ [ ![ PyPI] ( https://img.shields.io/pypi/v/pydocstyle-gitlab-code-quality?style=flat-square )] ( https://pypi.org/project/pydocstyle-gitlab-code-quality/ )
5
+ ![ PyPI - Downloads] ( https://img.shields.io/pypi/dm/pydocstyle-gitlab-code-quality?style=flat-square )
6
+
7
+ # pydocstyle-gitlab-code-quality
8
+
9
+ Generate [ GitLab Code Quality report] ( https://docs.gitlab.com/ee/ci/testing/code_quality.html ) from an output of [ pydocstyle] ( https://github.com/PyCQA/pydocstyle ) .
10
+
11
+ ## Usage
12
+
13
+ ``` bash
14
+ $ pydocstyle < file_path> | PYTHONHASHSEED=0 pydocstyle-gitlab-code-quality
15
+ ```
16
+
17
+ The output of this command is printed to ` stdout ` in JSON format, which can be used as Code Quality report.
18
+
19
+ Environment variable ` PYTHONHASHSEED=0 ` prevents randomized hashes, which are used by GitLab to determine changes between branches on merge request.
20
+
21
+ ### Example ` .gitlab-ci.yml ` file
22
+
23
+ ``` yaml
24
+ image : python:alpine
25
+ variables :
26
+ PIP_CACHE_DIR : " $CI_PROJECT_DIR/.cache/pip"
27
+
28
+ cache :
29
+ paths :
30
+ - .cache/pip/
31
+ - venv/
32
+
33
+ before_script :
34
+ - python --version # For debugging
35
+ - python -m venv venv
36
+ - . venv/bin/activate
37
+
38
+ codequality :
39
+ script :
40
+ - pip install pydocstyle pydocstyle-gitlab-code-quality
41
+ - pydocstyle program.py > pydocstyle-out.txt
42
+ - PYTHONHASHSEED=0 pydocstyle-gitlab-code-quality < pydocstyle-out.txt > codequality.json
43
+ artifacts :
44
+ when : always
45
+ reports :
46
+ codequality : codequality.json
47
+ allow_failure : true
48
+ ` ` `
49
+
50
+ ## Credits
51
+
52
+ This script was inspired by [mypy-gitlab-code-quality](https://github.com/soul-catcher/mypy-gitlab-code-quality). Thanks!
53
+
54
+ ## License
55
+
56
+ The project is licensed under MIT - a free and open-source license. For more information, please see [the license file](LICENSE.md).
You can’t perform that action at this time.
0 commit comments