工程(闸 09 存量红照实记+基线只降不升): 撤销「把两条恶化登记为现行值」的做法(用户裁:标准是尺,不以现状为尺)——①tools/gdstyle_baseline.txt 两条登记值回退 battle_orchestrator max-file-length 1314→1302、level_map_screen max-class-variables 22→21(波 0 已批准的 18 条陈旧键清理保留不动);②tools/gdstyle_gate.py 逐条 NEW/恶化行加 FAIL 前缀——gate 09 的存量红指纹只取含 FAIL 的行,原「NEW/WORSENED」行不进指纹,两次不同恶化集指纹相同=存量红期间任何新增违规或进一步恶化都会被「同款存量红」放过;顺带加 refresh 抬升守卫(重生成会把任一登记值抬高即拒写,须 --force 显式确认;原只有骤降守卫,37625317 曾借重生成静默吸收 3 条抬高);③game/tests/.gates/baseline.json 09 条目改 exit=1+现算指纹 91d45583cf6d(红项=上列两条,逐条点名可核;此前记的 user-approved-iter38 是手写标记,永不等于现算指纹,合回必被拦),note 记现行口径:阈值不变=gdstyle 默认(文件 1000 行/类变量 15 等),还债归迭代 40 卡①与迭代 41 卡③;④static_scan.sh S13 头注补 FAIL 前缀与只降不升两句。验证:--refresh 实测拒写且基线文件逐字节未变;静态扫描实测 exit=1,两条恶化逐条列名。
This commit is contained in:
1 parent
4f4a9bdaad
commit
05745df3fb
4 files changed
+38
-17
No files matched your search
@@ -3,8 +3,10 @@
|
||||
# (class variables/public methods/file length)=文件|规则;无数字条目=文件|规则|消息全文(裸键)。
|
||||
# 带数条目行格式「键 = 数值」,数值=消息剥掉 (max N) 段后首个整数;无数字条目裸键。
|
||||
# 判定=键不在基线红(NEW)、同键数值较登记值恶化红(WORSENED)、改小/持平不红。
|
||||
# 阈值口径=gdstyle 默认值(tools/gdstyle.toml 不设数值阈值);本文件只是欠账簿,登记值只准随
|
||||
# 还债下降,禁抬高到现状(抬高=把既有代码当尺子,默认恶化)。
|
||||
# 重生成=人工专用:python tools/gdstyle_gate.py --refresh(禁清基线换绿;改规则口径/工具升级须随批
|
||||
# 重生成;新键数较旧基线少逾 10% 须加 --force 显式确认)。
|
||||
# 重生成;新键数较旧基线少逾 10% 或登记值被抬高均拒写,须加 --force 显式确认)。
|
||||
game/core/action_economy.gd|quality/max-class-variables = 18
|
||||
game/core/adventure_runner.gd|quality/max-branches|_apply_curio_pick = 10
|
||||
game/core/adventure_runner.gd|quality/max-class-variables = 42
|
||||
@@ -13,7 +15,7 @@ game/core/adventure_runner.gd|quality/max-returns|_apply_curio_pick = 9
|
||||
game/core/battle_orchestrator.gd|quality/max-branches|begin_battle = 17
|
||||
game/core/battle_orchestrator.gd|quality/max-branches|use_treasure = 18
|
||||
game/core/battle_orchestrator.gd|quality/max-class-variables = 50
|
||||
game/core/battle_orchestrator.gd|quality/max-file-length = 1314
|
||||
game/core/battle_orchestrator.gd|quality/max-file-length = 1302
|
||||
game/core/battle_orchestrator.gd|quality/max-function-length|_place_variants = 52
|
||||
game/core/battle_orchestrator.gd|quality/max-function-length|begin_battle = 141
|
||||
game/core/battle_orchestrator.gd|quality/max-function-length|use_treasure = 62
|
||||
@@ -205,7 +207,7 @@ game/presentation/views/hero_info_panel_view.gd|quality/max-function-length|set_
|
||||
game/presentation/views/hero_info_panel_view.gd|quality/max-local-variables|set_treasure_inventory = 13
|
||||
game/presentation/views/legend_overlay.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
|
||||
game/presentation/views/level_map_screen.gd|quality/max-branches|_draw_graph = 9
|
||||
game/presentation/views/level_map_screen.gd|quality/max-class-variables = 22
|
||||
game/presentation/views/level_map_screen.gd|quality/max-class-variables = 21
|
||||
game/presentation/views/level_map_screen.gd|quality/max-function-length|_draw_graph = 78
|
||||
game/presentation/views/level_map_screen.gd|quality/max-function-length|_init = 135
|
||||
game/presentation/views/level_map_screen.gd|quality/max-local-variables|_draw_graph = 27
|
||||
|
||||
+26
-9
@@ -16,19 +16,25 @@ quality/*+syntax/reserved-identifier,format/naming/order 全关)。扫描
|
||||
带数条目行格式「键 = 数值」,数值=消息剥掉 (max N) 段后首个整数;无数字条目裸键无数值。
|
||||
判定:①键不在基线=新违规(NEW)红;②键在基线且双方有数值、当前数值 > 基线登记值=
|
||||
恶化(WORSENED)红——独立于差集,防稳定键吞掉 104→300 行式恶化;③其余绿(改小/持平不红)。
|
||||
逐条违规行带 FAIL 前缀——gate 09 的存量红指纹只取含 FAIL 的行,带前缀才能让「红项清单」
|
||||
(哪几条、恶化到多少)进指纹:否则存量红期间的任何新增/进一步恶化都算同款红被放行。
|
||||
|
||||
基线重生成=人工专用(--refresh,附新旧对账与骤降守卫),禁在闸内自动重生成(防清基线换绿);
|
||||
新键数较旧基线少逾 10% 时拒绝写入,须加 --force 显式确认(防扫面断裂静默缩基线换绿),
|
||||
--force 只在 refresh 路径有效。
|
||||
阈值口径=gdstyle 默认值(tools/gdstyle.toml 不设数值阈值);基线只是欠账簿,登记值只准因
|
||||
还债下降,禁抬高到现状(抬高=把既有代码当尺子,默认恶化)。
|
||||
|
||||
基线重生成=人工专用(--refresh,附新旧对账、骤降守卫与抬升守卫),禁在闸内自动重生成
|
||||
(防清基线换绿);新键数较旧基线少逾 10% 拒绝写入(防扫面断裂静默缩基线换绿);任一键登记
|
||||
值被抬高同样拒绝(防以现状为尺吞掉恶化)。两条守卫都须 --force 显式确认,--force 只在
|
||||
refresh 路径有效。
|
||||
|
||||
二进制:本机固定路径 D:/code/gdstyle/gdstyle.exe(不入库不入包),GDSTYLE_BIN 环境变量覆盖;
|
||||
版本与钉定版不符即红——升级工具须重测语法兼容性并人工重生成基线。
|
||||
|
||||
退出码:0=无基线外新违规且无恶化;1=有新违规/有恶化/二进制缺失或版本不符/扫描面为空/
|
||||
输出不可解析/refresh 骤降拒写;2=用法错。
|
||||
输出不可解析/refresh 骤降或抬升拒写;2=用法错。
|
||||
用法:python tools/gdstyle_gate.py # 闸判定
|
||||
python tools/gdstyle_gate.py --refresh # 人工重生成基线(覆盖旧文件,附对账)
|
||||
python tools/gdstyle_gate.py --refresh --force # 骤降守卫触发时显式确认写入
|
||||
python tools/gdstyle_gate.py --refresh --force # 骤降/抬升守卫触发时显式确认写入
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
@@ -171,6 +177,17 @@ def run_gate() -> int:
|
||||
if len(current) < len(old) * SHRINK_GUARD and not force:
|
||||
return fail("新键数 %d 较旧基线 %d 少逾 10%%——疑扫面断裂静默缩基线换绿,拒绝写入;"
|
||||
"确认缩基线正当(如删规则/缩扫描面)须加 --force 显式确认" % (len(current), len(old)))
|
||||
raised = sorted(
|
||||
(k, old[k], current[k]) for k in current
|
||||
if k in old and old[k] is not None and current[k] is not None and current[k] > old[k]
|
||||
)
|
||||
if raised and not force:
|
||||
for k, was, now in raised[:MAX_REPORT]:
|
||||
print(" FAIL 抬高 %s = %d(登记 %d)" % (k, now, was))
|
||||
if len(raised) > MAX_REPORT:
|
||||
print(" ...(截断,共 %d 条)" % len(raised))
|
||||
return fail("重生成会抬高 %d 条登记值——基线只准因还债下降,抬高=以现状为尺默认恶化;"
|
||||
"确属阈值口径变更或经用户批准须加 --force 显式确认" % len(raised))
|
||||
else:
|
||||
print("[gdstyle_gate] 旧基线不存在,跳过对账(首次落位)")
|
||||
write_baseline(current)
|
||||
@@ -191,15 +208,15 @@ def run_gate() -> int:
|
||||
red = False
|
||||
if new:
|
||||
for k in new[:MAX_REPORT]:
|
||||
print(" NEW " + k)
|
||||
print(" FAIL 新增 " + k)
|
||||
if len(new) > MAX_REPORT:
|
||||
print(" ...(截断,共 %d 条)" % len(new))
|
||||
print(" FAIL ...(截断,共 %d 条)" % len(new))
|
||||
red = True
|
||||
if worsened:
|
||||
for k in worsened[:MAX_REPORT]:
|
||||
print(" WORSENED %s = %d(基线登记 %d)" % (k, current[k], base[k]))
|
||||
print(" FAIL 恶化 %s = %d(基线登记 %d)" % (k, current[k], base[k]))
|
||||
if len(worsened) > MAX_REPORT:
|
||||
print(" ...(截断,共 %d 条)" % len(worsened))
|
||||
print(" FAIL ...(截断,共 %d 条)" % len(worsened))
|
||||
red = True
|
||||
if red:
|
||||
return fail("基线外新违规 %d 条/恶化 %d 条——新码须修到基线口径内,恶化须还债或经用户批准随批重生成基线"
|
||||
|
||||
Reference in new issue
Block a user