#!/bin/bash

set -euo pipefail

# defaults if not set
: "${SKIP_LINT:=0}"
: "${SKIP_TYPE_CHECKS:=0}"

# run linting
if [ "$SKIP_LINT" -ne 1 ]; then
  echo 'Running linting...'
  yamllint docker-compose.yaml
  uv lock --check
  uv run ruff check src --no-cache
  uv run ruff format src --diff --no-cache
else
    echo 'Skipping linting...'
fi

# run type checks
if [ "$SKIP_TYPE_CHECKS" -ne 1 ]; then
  uv run mypy --cache-dir=/dev/null src
else
  echo 'Skipping type checks...'
fi

echo 'Done!'
