Skip to content
Snippets Groups Projects
Commit c89534cb authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] update CONTRIBUTING.md

parent d18bf146
Branches
Tags 0.1.0
No related merge requests found
Pipeline #13921 waiting for manual action
# Contribute guide
## Pre-commit
We are using [`pre-commit`](https://pre-commit.com/) tool to perform checks on staged changes before committing.
We are using it for `black` formatting, `isort` imports sorting, `pylint` code linting, `mypy` typing, licence headers and `gitlab-ci` linting.
Install `pre-commit` from your distribution or install it from `pip`:
```bash
sudo apt install pre-commit
```
or
```bash
pip install --user pre-commit
```
To install the `git-hooks`, in the project folder, run:
```bash
pre-commit install
```
Then each time you commit changes, the hooks will perform checks.
To manually run one of the tool above, run (eg for `isort`):
```bash
pre-commit run --all-files isort
```
To run all checks on all files:
```bash
pre-commit run -a
```
### Authorization for GitLab CI linter hook
`pre-commit run -a (gitlab-ci-linter)` is failing due to authorization required for CI lint API accesses.
`make gitlab-ci-linter` is failing due to authorization required for CI lint API accesses.
When running this command, just ignore this failed hook.
In case you want to commit a `.gitlab-ci.yml` edition, this hook will prevent the commit creation.
You can [skip the hooks](https://stackoverflow.com/a/7230886) with `git commit -m "msg" --no-verify`.
......@@ -49,9 +21,9 @@ Check out #169 for more details.
We are using [Black](https://github.com/psf/black) formatter tool.
Run Black on a Python file to format it:
```bash
poetry run black duniterpy/file.py
poetry run black path/file.py
```
With `pre-commit`, Black is called on staged files, so the commit should fail in case black would make changes.
With `autohooks`, Black is called on staged files, so the commit should fail in case black would make changes.
You will have to add Black changes in order to commit your changes.
### Update copyright year
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment