From d5f2d8351185f503f8ecb9d086553df6f16b64d4 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Sat, 27 May 2023 12:59:44 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(githooks,=20Makefile):=20ad?= =?UTF-8?q?d=20pre-commit=20hook=20to=20run=20'make=20format'=20before=20c?= =?UTF-8?q?ommitting=20=F0=9F=94=A7=20chore(Makefile):=20add=20'init'=20ta?= =?UTF-8?q?rget=20to=20install=20pre-commit=20hooks=20The=20pre-commit=20h?= =?UTF-8?q?ook=20is=20added=20to=20run=20'make=20format'=20before=20commit?= =?UTF-8?q?ting.=20This=20ensures=20that=20the=20code=20is=20formatted=20c?= =?UTF-8?q?orrectly=20before=20it=20is=20committed.=20The=20Makefile=20is?= =?UTF-8?q?=20updated=20to=20include=20an=20'init'=20target=20that=20insta?= =?UTF-8?q?lls=20the=20pre-commit=20hooks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .githooks/pre-commit | 2 ++ Makefile | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 000000000..f5008c586 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,2 @@ + +make format \ No newline at end of file diff --git a/Makefile b/Makefile index 0d8556e47..3143d7983 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ -.PHONY: all format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage +.PHONY: all init format lint build build_frontend install_frontend run_frontend run_backend dev help tests coverage all: help +init: + @echo 'Installing pre-commit hooks' + git config core.hooksPath .githooks + pre-commit install + pre-commit install --hook-type pre-push + coverage: poetry run pytest --cov \ --cov-config=.coveragerc \ @@ -14,6 +20,7 @@ tests: format: poetry run black . poetry run ruff --select I --fix . + cd src/frontend && npm run format lint: poetry run mypy .