diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc695d8cfa1c75b44d8e15cc09df5fa524aef921..009c3d523d17612e17a03bd96c4ef894150f4dd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,19 +1,24 @@ # Contribute guide ## Pre-commit -We are using [`pre-commit`](https://pre-commit.com/) tool to perform checks on staged changes before committing. Such as black formatting. -Depending whether you prefer to work ouside or inside Poetry virtual environment, you should stick to one usage or use both to still have this usefull checks. -`pre-commit` can be used from the installation on your system or from inside Poetry virtual environment where it is installed. +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, and `gitlab-ci` linting. + +Install `pre-commit` from your distribution. In case it is an outdated version, install it from `pip`: +```bash +sudo apt install pre-commit +pip install --user pre-commit +``` To install the `git-hooks`, run: ```bash -pip3 install --user pre-commit duniterpy> 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 -duniterpy> poetry shell -(duniterpy-UyTOfZjU-py3.9) pre-commit install +duniterpy> pre-commit run isort --all-files ``` ### Black formatting