From a5afed584f4f9b2d0de841bec6b6e5f2be5a926e Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Wed, 29 Mar 2023 17:04:10 +0800 Subject: [PATCH] Only install pre-commit in setup-development-environment --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 829bf2d..8543f6c 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,18 @@ POETRY_EXISTS := $(shell which poetry &> /dev/null) +PRE_COMMIT_EXISTS := $(shell poetry run which pre-commit &> /dev/null) PRE_COMMIT_HOOK := .git/hooks/pre-commit -pre-commit: +pre-commit: setup-development-environment poetry run pre-commit install-poetry: ifndef POETRY_EXISTS curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.4.0 python3 - endif - poetry install + +ifndef PRE_COMMIT_EXISTS + poetry run pip install $(shell poetry export --without-hashes --with dev | grep pre-commit | cut -d";" -f1) +endif $(PRE_COMMIT_HOOK): poetry run pre-commit install --install-hooks