chore(makefiles): add format-check target and unify formatting logic

- Introduced `format-check` for verification without modification in `llm-gateway` and `knowledge-base` Makefiles.
- Updated `validate` to include `format-check`.
- Added `format-all` to root Makefile for consistent formatting across all components.
- Unexported `VIRTUAL_ENV` to prevent virtual environment warnings.
This commit is contained in:
2026-01-06 17:25:21 +01:00
parent b6c38cac88
commit 82c3a6ba47
3 changed files with 48 additions and 7 deletions

View File

@@ -1,4 +1,8 @@
.PHONY: help install install-dev lint lint-fix format type-check test test-cov validate clean run
.PHONY: help install install-dev lint lint-fix format format-check type-check test test-cov validate clean run
# Ensure commands in this project don't inherit an external Python virtualenv
# (prevents uv warnings about mismatched VIRTUAL_ENV when running from repo root)
unexport VIRTUAL_ENV
# Default target
help:
@@ -12,6 +16,7 @@ help:
@echo " make lint - Run Ruff linter"
@echo " make lint-fix - Run Ruff linter with auto-fix"
@echo " make format - Format code with Ruff"
@echo " make format-check - Check if code is formatted"
@echo " make type-check - Run mypy type checker"
@echo ""
@echo "Testing:"
@@ -19,7 +24,7 @@ help:
@echo " make test-cov - Run pytest with coverage"
@echo ""
@echo "All-in-one:"
@echo " make validate - Run lint, type-check, and tests"
@echo " make validate - Run all checks (lint + format + types)"
@echo ""
@echo "Running:"
@echo " make run - Run the server locally"
@@ -49,6 +54,10 @@ format:
@echo "Formatting code..."
@uv run ruff format .
format-check:
@echo "Checking code formatting..."
@uv run ruff format --check .
type-check:
@echo "Running mypy..."
@uv run mypy . --ignore-missing-imports
@@ -63,7 +72,7 @@ test-cov:
@uv run pytest tests/ -v --cov=. --cov-report=term-missing --cov-report=html
# All-in-one validation
validate: lint type-check test
validate: lint format-check type-check
@echo "All validations passed!"
# Running