#!/bin/bash
# Runs the curated Shardok clang-tidy gate used by CI.
#
# This intentionally checks representative files instead of the whole C++ tree.
# Keep this list low-noise; expand it as cleanup PRs make more areas tidy-clean.

set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
source "$repo_root/scripts/shardok_cpp_config.sh"

files=(
    "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
    "src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp"
)

compiler_args=(
    "-I$repo_root"
    "$SHARDOK_CXX_STANDARD_ARG"
)

if command -v xcrun >/dev/null 2>&1; then
    sdk_path="$(xcrun --show-sdk-path)"
    compiler_args+=("-isysroot" "$sdk_path")
fi

"$repo_root/scripts/run-clang-tidy.sh" --verify-config

"$repo_root/scripts/run-clang-tidy.sh" --quiet --warnings-as-errors="*" "${files[@]}" -- "${compiler_args[@]}"
