Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/awelzel/flake8-gl-codeclimate
Flake8 formatter producing Gitlab Code Quality artifacts.
https://github.com/awelzel/flake8-gl-codeclimate
codeclimate flake8 flake8-plugin gitlab gitlab-ci python
Last synced: 2 months ago
JSON representation
Flake8 formatter producing Gitlab Code Quality artifacts.
- Host: GitHub
- URL: https://github.com/awelzel/flake8-gl-codeclimate
- Owner: awelzel
- License: mit
- Created: 2019-07-06T16:01:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-23T17:09:07.000Z (about 1 year ago)
- Last Synced: 2024-11-14T19:09:26.660Z (2 months ago)
- Topics: codeclimate, flake8, flake8-plugin, gitlab, gitlab-ci, python
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 25
- Watchers: 1
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flake8-extensions - flake8-gl-codeclimate - Generates GitLab Code Quality artifacts. (Formatters)
README
# flake8-gl-codeclimate
[![Build Status](https://travis-ci.org/awelzel/flake8-gl-codeclimate.svg?branch=master)](https://travis-ci.org/awelzel/flake8-gl-codeclimate)
Flake8 formatter producing [Gitlab Code Quality artifacts][1].
## Usage
By default, Flake8 will print to standard output. However, the purpose of this
formatter is to produce a JSON file that is then stored as Code Quality artifact
by Gitlab (see below) - the output itself isn't very human-readable:
```
$ pip install flake8-gl-codeclimate
$ flake8 --format gl-codeclimate examples/trailing-whitespace.py
[
{"type": "issue", "check_name": "pycodestyle", "description": "trailing whitespace [W291]", ... }
]
```## Adding it to Gitlab
To enable Code Quality reports based on Flake8 in Gitlab merge requests,
add a configuration as follows to your projects `gitlab-ci.yml` file.```
flake8:
script:
- pip install flake8-gl-codeclimate
- flake8 --exit-zero --format gl-codeclimate --output-file gl-code-quality-report.json my_package/
artifacts:
reports:
codequality: gl-code-quality-report.json
```
This will upload the `gl-code-quality-report.json` as Gitlab Code Quality artifact.
Afterwards, code quality improvements and degradations should show up in
merge requests on Gitlab.Gitlab Code Quality artifacts are a subset of the [Code Climate spec][2].
Have fun!
[1]: https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html
[2]: https://github.com/codeclimate/spec/blob/master/SPEC.md#data-types