diff --git a/.docs/images/format.png b/.docs/images/format.png index 409de27..7dd3784 100644 Binary files a/.docs/images/format.png and b/.docs/images/format.png differ diff --git a/.docs/images/pre-commit.png b/.docs/images/pre-commit.png index b329870..32a203f 100644 Binary files a/.docs/images/pre-commit.png and b/.docs/images/pre-commit.png differ diff --git a/README.md b/README.md index d3a3283..7fc0620 100755 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ You only need to install [Docker](https://docs.docker.com/engine/install/) and [ To start the containers, just run `docker-compose up` (or `docker-compose up -d` if you want to run the containers in background); or `docker-compose create` and `docker-compose start` if you don't want to see the logs. Once the containers are running, you can go to `http://localhost:8000/docs` to see the automatic interactive API documentation. +For making code changes, installing `pre-commit` is necessary (see section [Code tools: pre-commit](#pre-commit)) + ## Migrations We use Alembic as database migration tool. To run its commands you can open an interactive shell inside the backend container (you can use `./exec.sh bash` shortcut), or use the following shortcuts under the `/scripts` directory: - `./exec.sh migrate` -> runs all the migrations @@ -39,14 +41,10 @@ Ensure everything was set up correctly by running the hooks: You can add new `pre-commit` hooks by editing `.pre-commit-config.yaml`. Whenever new hooks are added, you must run `pre-commit install` to ensure new hooks are run on commit. +### Linting, formatting and type checking -Linters, formatters, etc. - -- **Pycln**: Formatter for finding and removing unused import statements. -- **isort**: Tool to sort imports alphabetically and automatically separate into sections by type. -- **flake8**: Linting tool +- **ruff**: Linter and formatter - **mypy**: Static type checker -- **black**: PEP 8 compliant opinionated formatter There is a shortcut under the `/scripts` directory that runs all this tools for you (`./exec.sh format`). diff --git a/scripts/format.sh b/scripts/format.sh index e5a61c7..440387a 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -2,3 +2,9 @@ printf "\nRunning mypy...\n" mypy src + +printf "\nRunning ruff check...\n" +ruff check --fix + +printf "\nRunning ruff format...\n" +ruff format