#!/bin/sh -e

# Assumes running from pywire-language-server root
# Usage: ./scripts/check

FILES="src/pywire_language_server"

echo "-> Formatting..."
uv run ruff format --check --diff $FILES

echo "-> Type Checking..."
uv run mypy $FILES

echo "-> Linting..."
uv run ruff check $FILES

echo "-> Testing (Multi-version)..."
# Use uv run to execute tox from dev dependencies, ensuring availability for all cloners
if command -v tox >/dev/null 2>&1; then
    TOX_PARALLEL_NO_SPINNER=1 tox -q -p auto
else
    # Fallback to uv run tox if global tox not found
    TOX_PARALLEL_NO_SPINNER=1 uv run tox -q -p auto || uv run pytest
fi
