CONTRIBUTING.md 1.07 KB
Newer Older
Trond Aasan's avatar
Trond Aasan committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Contributing to orgreg-client

## The contribution process at a glance

1. Read the [README.md file](README.md).
2. Set up your environment to be able to [run all tests](README.md#running-the-tests).  They must pass
3. Prepare your changes:
    * Make sure your tests pass cleanly on [mypy](README.md#type-check), [bandit](https://bandit.readthedocs.io/), and [flake8](https://flake8.pycqa.org/)
    * [Format your code](#code-style) with `black`
    * Create a merge request

## Code style

### Black

This project uses [black](https://github.com/psf/black/) to format the code.
See [black documentation](https://black.readthedocs.io/en/stable/editor_integration.html) for how to set up _black_ with your editor.

To autoformat all code, run

```shell script
git ls-files '*.py' | xargs black
```

[Flake8](https://flake8.pycqa.org/en/latest/) is also used as a linter.

Code style errors will result in CI pipeline failing.

You can use a `pre-commit` hook to have git run linters before commit.
Save this to `.git/hooks/pre-commit` and make it executable.

```sh
#!/bin/sh

tox -e linters
```