diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 279475cee29df1088b07f5447ae3db0c6d5e894e..ab6185147a32c4914b813410596771765ca27aa4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,19 +1,28 @@ # 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> pre-commit run --all-files isort +``` +To run all checks on all files: ```bash -duniterpy> poetry shell -(duniterpy-UyTOfZjU-py3.9) pre-commit install +duniterpy> pre-commit run -a ``` ### Black formatting