diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9359b4dc4cd6679f8e9660d21853f2530e04b11b..f649086c9d781b8b380aced07587c131f0ccacbb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,35 +1,7 @@ # 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