less verbose git hooks

This commit is contained in:
Nicolò Boschi 2025-12-16 13:49:38 +01:00
parent 9394cf92f2
commit 11ac9cd9a5
2 changed files with 26 additions and 8 deletions

View file

@ -1,13 +1,22 @@
#!/bin/bash
# Lint Node/TypeScript code with ESLint and Prettier
set -e
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT/hindsight-control-plane"
echo " Linting Node/TS with ESLint and Prettier..."
npx eslint --fix "src/**/*.{ts,tsx}"
npx prettier --write "src/**/*.{ts,tsx}"
# Capture output and only show on failure
OUTPUT=$(npx eslint --fix "src/**/*.{ts,tsx}" 2>&1)
if [ $? -ne 0 ]; then
echo "$OUTPUT"
exit 1
fi
OUTPUT=$(npx prettier --write "src/**/*.{ts,tsx}" 2>&1)
if [ $? -ne 0 ]; then
echo "$OUTPUT"
exit 1
fi
echo " Node lint complete"

View file

@ -1,13 +1,22 @@
#!/bin/bash
# Lint Python code with Ruff
set -e
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT/hindsight-api"
echo " Linting Python with Ruff..."
uv run ruff check --fix .
uv run ruff format .
# Capture output and only show on failure
OUTPUT=$(uv run ruff check --fix . 2>&1)
if [ $? -ne 0 ]; then
echo "$OUTPUT"
exit 1
fi
OUTPUT=$(uv run ruff format . 2>&1)
if [ $? -ne 0 ]; then
echo "$OUTPUT"
exit 1
fi
echo " Python lint complete"