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.
We are using it for `black` formatting, `isort` imports sorting, and `gitlab-ci` linting. We will use it for `pylint` code linting, `mypy` typing in the future.
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
sudo apt install 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.
You will have to add Black changes in order to commit your 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 `git add` Black changes in order to commit your changes.
## Tests
We are using [Pytest](https://pytest.org) as a tests framework. To know more about how Silkaj implement it read the [project test documentation](doc/test_and_coverage.md).