From 5ddf5be4b1b787930f17ac7c223fccd7776cfe0f Mon Sep 17 00:00:00 2001 From: Lam Chau Date: Mon, 30 Sep 2024 14:29:57 -0700 Subject: [PATCH] fix: resolve uvx when using a git client or IDE (#98) --- justfile | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 9b89e6a9e..8b2ca2338 100644 --- a/justfile +++ b/justfile @@ -8,8 +8,16 @@ integration *FLAGS: uv run pytest tests -m integration {{FLAGS}} format: - uvx ruff check . --fix - uvx ruff format . + #!/usr/bin/env bash + UVX_PATH="$(which uvx)" + + if [ -z "$UVX_PATH" ]; then + echo "[error]: unable to find uvx" + exit 1 + fi + eval "$UVX_PATH ruff format ." + eval "$UVX_PATH ruff check . --fix" + coverage *FLAGS: uv run coverage run -m pytest tests -m "not integration" {{FLAGS}} @@ -19,6 +27,26 @@ coverage *FLAGS: docs: uv sync && uv run mkdocs serve +install-hooks: + #!/usr/bin/env bash + HOOKS_DIR="$(git rev-parse --git-path hooks)" + + if [ ! -d "$HOOKS_DIR" ]; then + mkdir -p "$HOOKS_DIR" + fi + + cat > "$HOOKS_DIR/pre-commit" <