fix pre-commit hook and code quality fixes
This commit is contained in:
parent
d2fc802ef9
commit
607f872c71
3 changed files with 27 additions and 11 deletions
|
|
@ -1,12 +1,20 @@
|
|||
#!/bin/bash
|
||||
# Pre-commit hook to ensure generated types and constants are up-to-date
|
||||
# Pre-commit hook to run code quality tools and ensure generated types are up-to-date
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Checking shared constants..."
|
||||
cd backend && uv run python validate_constants.py
|
||||
cd ..
|
||||
# Get the root of the repository
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
echo "🔧 Running code quality checks (ruff, mypy, bandit, eslint, prettier)..."
|
||||
echo ""
|
||||
|
||||
# Run pre-commit framework hooks on staged files
|
||||
cd backend && uv run pre-commit run
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
echo ""
|
||||
echo "🔍 Checking if generated types are fresh..."
|
||||
|
||||
# Check if api.ts is staged
|
||||
|
|
@ -15,13 +23,19 @@ if git diff --cached --name-only | grep -q "frontend/app/generated/api.ts"; then
|
|||
else
|
||||
# Check if backend schema files have changed
|
||||
if git diff --cached --name-only | grep -qE "backend/(schemas|models|routes)"; then
|
||||
echo "⚠️ Backend schema files changed but generated types not staged."
|
||||
echo " Run 'make generate-types-standalone' and stage the changes."
|
||||
echo ""
|
||||
echo " To skip this check (not recommended): git commit --no-verify"
|
||||
exit 1
|
||||
# Check if api.ts has unstaged changes (meaning types need to be staged)
|
||||
if git diff --name-only | grep -q "frontend/app/generated/api.ts"; then
|
||||
echo "⚠️ Backend schema files changed and generated types have unstaged changes."
|
||||
echo " Run 'git add frontend/app/generated/api.ts' to stage the changes."
|
||||
echo ""
|
||||
echo " To skip this check (not recommended): git commit --no-verify"
|
||||
exit 1
|
||||
else
|
||||
echo "✓ Generated types are up to date (no changes needed)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "✅ Pre-commit checks passed"
|
||||
echo ""
|
||||
echo "✅ All pre-commit checks passed"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
"""Booking routes for users to book appointments."""
|
||||
|
||||
from collections.abc import Sequence
|
||||
from datetime import UTC, date, datetime, time, timedelta
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
|
|
@ -86,7 +87,7 @@ def _validate_booking_date(d: date) -> None:
|
|||
|
||||
|
||||
def _expand_availability_to_slots(
|
||||
availability_slots: list[Availability],
|
||||
availability_slots: Sequence[Availability],
|
||||
target_date: date,
|
||||
) -> list[BookableSlot]:
|
||||
"""Expand availability time ranges into 15-minute bookable slots."""
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
.next/
|
||||
node_modules/
|
||||
app/generated/
|
||||
test-results/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue