增加回测引擎旧数据源守卫
This commit is contained in:
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
fail() {
|
||||
local message="$1"
|
||||
local details="${2:-}"
|
||||
printf '[FAIL] %s\n' "$message" >&2
|
||||
if [[ -n "$details" ]]; then
|
||||
printf '%s\n' "$details" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
runtime_hits="$(
|
||||
rg -n \
|
||||
--glob '!**/.git/**' \
|
||||
--glob '!**/target/**' \
|
||||
--glob '!**/docs/**' \
|
||||
--glob '!**/*.md' \
|
||||
--glob '!**/tests/**' \
|
||||
--glob '!**/*test*.rs' \
|
||||
--glob '!scripts/verify-no-legacy-data-source.sh' \
|
||||
'fidatacenter|FIDATACENTER|/v1/backtest/data|/v1/xuntou|ClickHouse|clickhouse|CLICKHOUSE' \
|
||||
crates Cargo.toml \
|
||||
2>/dev/null || true
|
||||
)"
|
||||
|
||||
if [[ -n "$runtime_hits" ]]; then
|
||||
fail "legacy fidatacenter/ClickHouse runtime data source references are not allowed in fidc-backtest-engine" "$runtime_hits"
|
||||
fi
|
||||
|
||||
manifest_hits="$(
|
||||
rg -n --glob '!scripts/verify-no-legacy-data-source.sh' '\b(mysql|mariadb|clickhouse|clickhouse-rs|mysql_async|sqlx-mysql)\b' Cargo.toml crates 2>/dev/null || true
|
||||
)"
|
||||
|
||||
if [[ -n "$manifest_hits" ]]; then
|
||||
fail "legacy database dependencies are not allowed in fidc-backtest-engine manifests" "$manifest_hits"
|
||||
fi
|
||||
|
||||
printf '[OK] fidc-backtest-engine has no legacy runtime data-source references\n'
|
||||
Reference in New Issue
Block a user