#!/usr/bin/env bash
set -e

ISORT_ARGS="-c"
BLACK_ARG="--check"
RUFF_ARG=""
TAPLO_ARG="format --check"

if [ "$1" = "fix" ] ; then
    ISORT_ARGS=""
    BLACK_ARG=""
    RUFF_ARG="--fix"
    TAPLO_ARG="format"
fi

taplo ${TAPLO_ARG}
echo isort
uv run isort quantflow quantflow_tests ${ISORT_ARGS}
echo black
uv run black quantflow quantflow_tests ${BLACK_ARG}
echo ruff
uv run ruff check quantflow quantflow_tests ${RUFF_ARG}
echo mypy
uv run mypy quantflow
echo mypy tests
uv run mypy quantflow_tests --explicit-package-bases
