#!/bin/bash

# script/lint-check: Check linting without making changes
#
# Runs Ruff in check-only mode without applying fixes. Useful for CI/CD
# and pre-commit validation.
#
# Usage:
#   ./scripts/lint-check
#
# Examples:
#   ./scripts/lint-check

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR/.."

# shellcheck source=scripts/.lib/output.sh
source "$SCRIPT_DIR/.lib/output.sh"

if [[ -z ${VIRTUAL_ENV:-} ]]; then
    # shellcheck source=/dev/null
    source "$HOME/.venv/bin/activate"
fi

log_header "Checking code format"
uv run --active ruff format . --check

log_header "Checking code with Ruff"
uv run --active ruff check .

# Clean up any accidental package installation from uv run
"$SCRIPT_DIR/clean" --minimal

log_success "Linting check completed"
