diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8ddeec5f5ebbd813902e7155fbbc02857e94757..eaf1ed90a470f8a4bf27cd6ce16331bde2e5ac81 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,18 +44,29 @@ Please read their documentations on how to use them the best possible. - [Pendulum](https://pendulum.eustace.io/docs/) - [texttable](https://github.com/foutaise/texttable/#documentation) -## Formatting -We are using [Black](https://github.com/python/black) formatter tool. -To have Black installed in your Poetry virtualenv, you will need Python v3.6 or greater. +## 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. + +To install the `git-hooks`, run: +```bash +pip3 install --user pre-commit +silkaj> pre-commit install +``` + +```bash +silkaj> poetry shell +(silkaj-58dUTebQ-py3.9) pre-commit install +``` + +### Black formatting +We are using [Black](https://github.com/psf/black) formatter tool. Run Black on a Python file to format it: ```bash poetry run black silkaj/cli.py ``` - -### Pre-commit -Then, you can use the `pre-commit` tool to check staged changes before committing. -To do so, you need to run `pre-commit install` to install the git hook. -Black is called on staged files, so commit should fail in case black made changes. +With `pre-commit`, 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. ## Tests