#!/bin/bash

# script/check: Run linting and type checking tools together
#
# Runs both type-check (Pyright) and lint-check (Ruff) in sequence.
# Recommended before committing changes.
#
# Usage:
#   ./scripts/check
#
# Examples:
#   ./scripts/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

"$SCRIPT_DIR/type-check"
echo ""
"$SCRIPT_DIR/lint-check"

log_success "All checks passed"
