diff --git a/{{cookiecutter.project_name}}/README.md b/{{cookiecutter.project_name}}/README.md index fd4eefd..0be1fd5 100644 --- a/{{cookiecutter.project_name}}/README.md +++ b/{{cookiecutter.project_name}}/README.md @@ -75,6 +75,7 @@ The project includes the following convenience commands: - `make install`: Install the project and its dependencies in a virtual environment. - `make install-pre-commit`: Install pre-commit hooks for linting, formatting and type checking. - `make lint`: Lint the code using `ruff`. +- `make format`: Format the code using `ruff`. - `make type-check`: Type check the code using `mypy`. - `make test`: Run tests using `pytest` and update the coverage badge in the readme. - `make docker`: Build a Docker image and run the Docker container. diff --git a/{{cookiecutter.project_name}}/makefile b/{{cookiecutter.project_name}}/makefile index cf214a2..aa0d700 100644 --- a/{{cookiecutter.project_name}}/makefile +++ b/{{cookiecutter.project_name}}/makefile @@ -250,6 +250,13 @@ lint: ## Lint the project . .venv/bin/activate && ruff check src --fix {%- endif %} +format: ## Format the project + {% if cookiecutter.dependency_manager != 'pip' -%} + poetry run ruff format src + {%- else -%} + . .venv/bin/activate && ruff format src + {%- endif %} + type-check: ## Type-check the project {% if cookiecutter.dependency_manager != 'pip' -%} @poetry run mypy src --install-types --non-interactive --ignore-missing-imports --show-error-codes --check-untyped-defs