From be1f3c07f09cdbd6c13c767de9e82f45050f63f8 Mon Sep 17 00:00:00 2001 From: DKChan <524912269@qq.com> Date: Tue, 3 Nov 2026 08:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(CI=E8=BF=BD=E7=BB=BF=C2=B7fi?= =?UTF-8?q?x-ci-obs=E7=BB=AD):=20static=5Fscan=E8=A7=A3=E9=87=8A=E5=99=A8?= =?UTF-8?q?=E5=9B=9E=E8=90=BD=E2=80=94=E2=80=94runner=20PATH=E5=8F=AA?= =?UTF-8?q?=E6=9C=89python3(=E9=97=B8=E8=84=9A=E6=9C=AC=E6=A8=AA=E5=B9=85p?= =?UTF-8?q?ython:python3=E4=B8=BA=E8=AF=81),=E7=A1=AC=E7=BC=96=E7=A0=81pyt?= =?UTF-8?q?hon=E4=B8=89=E5=A4=84=E8=B0=83=E7=94=A8=3D127=20command=20not?= =?UTF-8?q?=20found=E5=AE=A1=E8=AE=A1=E9=9B=B6=E8=BE=93=E5=87=BA=E9=9D=99?= =?UTF-8?q?=E9=BB=98=E5=88=A4=E7=BA=A2(run15=E5=AE=9E=E8=AF=81:S9/S10/S13?= =?UTF-8?q?=E4=B8=89FAIL=E9=9B=B6=E6=98=8E=E7=BB=86=E8=A1=8C);=20=E5=8A=A0?= =?UTF-8?q?PY=5FBIN=E8=A7=A3=E6=9E=90(python=E2=86=92python3=E2=86=92?= =?UTF-8?q?=E6=97=A0=E5=88=99=E6=98=BE=E5=BC=8F=E7=BA=A2),=E4=B8=89?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=94=B9$PY=5FBIN;=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E8=B7=91=E5=A4=8D=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/tests/static_scan.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/game/tests/static_scan.sh b/game/tests/static_scan.sh index c1e8a1c1..1be94af6 100755 --- a/game/tests/static_scan.sh +++ b/game/tests/static_scan.sh @@ -20,6 +20,16 @@ fail=0 DIR_CORE="game/core" DIR_PRES="game/presentation" +# python 解释器解析:PATH 有 python 用 python,只有 python3(runner 常态)回落 python3—— +# 硬编码 python 在无别名机器上=127 command not found,三审计零输出静默判红(CI run15 实证)。 +PY_BIN="" +if command -v python >/dev/null 2>&1; then PY_BIN="python" +elif command -v python3 >/dev/null 2>&1; then PY_BIN="python3" +else + echo "[static_scan] FAIL: 无 python 解释器(PATH 上既无 python 也无 python3)" + exit 1 +fi + scan_files() { # scan_files <目录> — 该目录下 .gd 文件数 find "$1" -name '*.gd' 2>/dev/null | wc -l } @@ -36,7 +46,7 @@ require_scan_face() { # require_scan_face <规则名> <目录> — 扫描面 } # S9 — 类型闸(code-conventions §4 机器闸:产品码无类型容器/有值返回缺类型/参数缺类型) -if python tools/audit_type_hints.py; then +if "$PY_BIN" tools/audit_type_hints.py; then echo "[static_scan] S9 ok" else echo "[static_scan] S9 FAIL: 类型闸存量未归零(R1/R2/R3 见上清单)" @@ -44,7 +54,7 @@ else fi # S10 — 文件头闸(code-conventions §1.4.1:## 载体+日期/变更叙事黑名单;行数上限已停用) -if python tools/audit_file_headers.py; then +if "$PY_BIN" tools/audit_file_headers.py; then echo "[static_scan] S10 ok" else echo "[static_scan] S10 FAIL: 文件头存量见上清单" @@ -296,7 +306,7 @@ fi # 簿,登记值只准随还债下降,禁抬高到现状。基线重生成=人工专用(python tools/gdstyle_gate.py # --refresh,附对账;键数骤降逾 10% 或登记值被抬高均拒写,须 --force),禁清基线换绿。二进制本机固定路径 # D:/code/gdstyle/gdstyle.exe(不入库),GDSTYLE_BIN 环境变量覆盖;版本与钉定版不符即红(升级须重测)。 -if python tools/gdstyle_gate.py; then +if "$PY_BIN" tools/gdstyle_gate.py; then echo "[static_scan] S13 ok" else echo "[static_scan] S13 FAIL: 基线外新违规/指标恶化或二进制/版本/扫描面问题(清单见上)"