merge(master)+禁令残留清扫:并回 master 新进提交(gdstyle 闸件批/S9 卡/iter36 收尾),冲突 test-conventions §8.4 保重编号版+吸收 master 新条款「判据绑可观测提交面」(措辞去变异化);随批清扫——待办清单 gdstyle/S9 两条目「变异验证义务」改撤销证明口径;S9 活卡全量改写(契约 3/T2/D2/D4/来源行/对照表列头/审计面/两轮 grilling 记录——旧「闸件豁免」定界标注经用户全项目禁令推翻,验证义务统一撤销证明,禁令条款原文保留)

This commit is contained in:
DKChan committed 2026-10-25 01:31:21 +08:00
commit e89f486aa9
94 files changed
+4608 -3451

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
# gdstyle.toml — S13 第三方质量规则闸的 gdstyle 配置(tools/gdstyle_gate.py 以 -c 显式指定本文件)
#
# 只开质量类规则:抓真缺陷(重复 load/循环内 await/循环内分配/不可达代码/自比较/字典重复键等),
# 存量进 tools/gdstyle_baseline.txt,基线外新违规才红。format/*/naming/*/order/* 与 S9/S10 职能重叠
# 全关(gdstyle 不支持通配符关停,须逐条枚举);syntax/lex-error 关——core/rng_service.gd 的
# INT64_MIN 负字面量是已知误报(Godot 自家解析器放行);type-hint 与 S9 类型闸重叠关;
# empty-function 关(合法桩形态自由)。quality/no-debug-print 本是 opt-in 默认不跑,此处显式开
# ——产品码残留 print() 属真缺陷。阈值(函数长度/参数数等)取 gdstyle 默认值:
# 改阈值=基线口径变,须随批人工重生成基线。工具版本钉 v0.4.0(闸件校验,升级须重测兼容性)。
[rules]
# ── 格式类全关(与 S9 类型闸/S10 文件头闸职能重叠)──
"format/blank-lines" = "off"
"format/boolean-operators" = "off"
"format/brace-spacing" = "off"
"format/call-paren-spacing" = "off"
"format/colon-spacing" = "off"
"format/comma-spacing" = "off"
"format/comment-spacing" = "off"
"format/double-quotes" = "off"
"format/enum-one-per-line" = "off"
"format/float-literal-zeros" = "off"
"format/large-number-underscores" = "off"
"format/max-line-length" = "off"
"format/no-tabs-as-spaces" = "off"
"format/no-unnecessary-parens" = "off"
"format/number-literals" = "off"
"format/one-statement-per-line" = "off"
"format/operator-spacing" = "off"
"format/trailing-comma" = "off"
"format/trailing-newline" = "off"
"format/trailing-whitespace" = "off"
# ── 命名类全关(命名纪律归 code-conventions 与评审面)──
"naming/class-name-pascal-case" = "off"
"naming/constant-name-screaming-case" = "off"
"naming/enum-member-screaming-case" = "off"
"naming/enum-name-pascal-case" = "off"
"naming/file-name-snake-case" = "off"
"naming/function-name-snake-case" = "off"
"naming/node-name-pascal-case" = "off"
"naming/private-underscore-prefix" = "off"
"naming/signal-name-snake-case" = "off"
"naming/signal-past-tense" = "off"
"naming/variable-name-snake-case" = "off"
# ── 排序类关(官方风格指南性质,存量过大)──
"order/class-member-order" = "off"
# ── 语法类:lex-error 关(已知误报),reserved-identifier 留守(保留字当名字=真缺陷)──
"syntax/lex-error" = "off"
# ── 质量类关两条(职能重叠),其余 quality/* 全部默认 warn 在跑 ──
"quality/type-hint" = "off"
"quality/empty-function" = "off"
"quality/no-debug-print" = "warn"
+241
View File
@@ -0,0 +1,241 @@
# gdstyle 存量基线(S13)——文件|规则|消息 三元组,每行一条;只记基线不记豁免理由。
# 重生成=人工专用:python tools/gdstyle_gate.py --refresh(禁清基线换绿;改规则口径/工具升级须随批重生成)。
game/core/action_economy.gd|quality/max-class-variables|class has 18 variables (max 15)
game/core/adventure_runner.gd|quality/max-branches|function '_apply_curio_pick' has 10 branches (max 8)
game/core/adventure_runner.gd|quality/max-branches|function '_draw_curio_candidates' has 11 branches (max 8)
game/core/adventure_runner.gd|quality/max-branches|function 'resume_adventure' has 10 branches (max 8)
game/core/adventure_runner.gd|quality/max-class-variables|class has 43 variables (max 15)
game/core/adventure_runner.gd|quality/max-file-length|file is 1050 lines long (max 1000)
game/core/adventure_runner.gd|quality/max-function-length|function '_draw_curio_candidates' is 85 lines long (max 50)
game/core/adventure_runner.gd|quality/max-function-length|function '_start_current_level' is 55 lines long (max 50)
game/core/adventure_runner.gd|quality/max-function-length|function 'resume_adventure' is 104 lines long (max 50)
game/core/adventure_runner.gd|quality/max-local-variables|function '_draw_curio_candidates' has 26 local variables (max 10)
game/core/adventure_runner.gd|quality/max-local-variables|function 'resume_adventure' has 13 local variables (max 10)
game/core/adventure_runner.gd|quality/max-public-methods|class has 23 public methods (max 20)
game/core/adventure_runner.gd|quality/max-returns|function '_apply_curio_pick' has 9 return statements (max 6)
game/core/battle_orchestrator.gd|quality/max-branches|function 'begin_battle' has 17 branches (max 8)
game/core/battle_orchestrator.gd|quality/max-branches|function 'use_treasure' has 18 branches (max 8)
game/core/battle_orchestrator.gd|quality/max-class-variables|class has 50 variables (max 15)
game/core/battle_orchestrator.gd|quality/max-file-length|file is 1302 lines long (max 1000)
game/core/battle_orchestrator.gd|quality/max-function-length|function '_place_variants' is 52 lines long (max 50)
game/core/battle_orchestrator.gd|quality/max-function-length|function 'begin_battle' is 141 lines long (max 50)
game/core/battle_orchestrator.gd|quality/max-function-length|function 'use_treasure' is 62 lines long (max 50)
game/core/battle_orchestrator.gd|quality/max-local-variables|function '_place_variants' has 14 local variables (max 10)
game/core/battle_orchestrator.gd|quality/max-local-variables|function 'begin_battle' has 16 local variables (max 10)
game/core/battle_orchestrator.gd|quality/max-local-variables|function 'use_treasure' has 11 local variables (max 10)
game/core/battle_orchestrator.gd|quality/max-nesting-depth|function '_place_variants' has nesting depth 6 (max 4)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_apply_flat_row' has 7 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_apply_gp_row' has 6 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_apply_percent_row' has 6 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_dispatch_row' has 6 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_emit_row' has 8 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_grant_routed' has 8 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-parameters|function '_submit_flat_hero' has 7 parameters (max 5)
game/core/battle_orchestrator.gd|quality/max-returns|function '_apply_flat_row' has 9 return statements (max 6)
game/core/battle_orchestrator.gd|quality/max-returns|function '_fx_fact' has 7 return statements (max 6)
game/core/battle_orchestrator.gd|quality/max-returns|function 'begin_battle' has 7 return statements (max 6)
game/core/battle_orchestrator.gd|quality/max-returns|function 'use_treasure' has 8 return statements (max 6)
game/core/board_generator.gd|quality/max-branches|function 'measure_inferability' has 12 branches (max 8)
game/core/board_generator.gd|quality/max-function-length|function '_attempt' is 51 lines long (max 50)
game/core/board_generator.gd|quality/max-function-length|function 'generate' is 62 lines long (max 50)
game/core/board_generator.gd|quality/max-function-length|function 'measure_inferability' is 64 lines long (max 50)
game/core/board_generator.gd|quality/max-local-variables|function 'generate' has 14 local variables (max 10)
game/core/board_generator.gd|quality/max-local-variables|function 'measure_inferability' has 13 local variables (max 10)
game/core/board_generator.gd|quality/max-nesting-depth|function 'measure_inferability' has nesting depth 5 (max 4)
game/core/board_generator.gd|quality/max-parameters|function '_finalize' has 6 parameters (max 5)
game/core/config_db.gd|quality/max-class-variables|class has 25 variables (max 15)
game/core/config_db.gd|quality/max-public-methods|class has 44 public methods (max 20)
game/core/config_db_cross_validator.gd|quality/max-branches|function 'cross_validate' has 31 branches (max 8)
game/core/config_db_cross_validator.gd|quality/max-function-length|function 'cross_validate' is 159 lines long (max 50)
game/core/config_db_cross_validator.gd|quality/max-local-variables|function 'cross_validate' has 39 local variables (max 10)
game/core/config_db_cross_validator.gd|quality/max-local-variables|function 'validate_skill_pool_links' has 11 local variables (max 10)
game/core/config_db_cross_validator.gd|quality/max-nesting-depth|function 'cross_validate' has nesting depth 6 (max 4)
game/core/config_db_resolver.gd|quality/max-branches|function '_resolve_progress' has 16 branches (max 8)
game/core/config_db_resolver.gd|quality/max-branches|function 'resolve_enemy_rowset' has 12 branches (max 8)
game/core/config_db_resolver.gd|quality/max-function-length|function '_resolve_progress' is 52 lines long (max 50)
game/core/config_db_resolver.gd|quality/max-local-variables|function '_resolve_progress' has 11 local variables (max 10)
game/core/damage_controller.gd|quality/max-branches|function '_hero_attack_ctx' has 9 branches (max 8)
game/core/damage_controller.gd|quality/max-branches|function '_hero_attack_redeem' has 10 branches (max 8)
game/core/damage_controller.gd|quality/max-class-variables|class has 19 variables (max 15)
game/core/damage_controller.gd|quality/max-function-length|function '_hero_attack_ctx' is 61 lines long (max 50)
game/core/damage_controller.gd|quality/max-function-length|function '_hero_attack_redeem' is 54 lines long (max 50)
game/core/damage_controller.gd|quality/max-local-variables|function '_hero_attack_ctx' has 16 local variables (max 10)
game/core/damage_controller.gd|quality/max-local-variables|function '_hero_attack_redeem' has 12 local variables (max 10)
game/core/damage_controller.gd|quality/max-local-variables|function '_resolve_enemy_skill' has 13 local variables (max 10)
game/core/damage_controller.gd|quality/max-parameters|function 'open_ticket' has 12 parameters (max 5)
game/core/effect_engine.gd|quality/max-branches|function 'validate_trigger_row' has 14 branches (max 8)
game/core/effect_engine.gd|quality/max-function-length|function '_cond_ok' is 52 lines long (max 50)
game/core/effect_engine.gd|quality/max-function-length|function 'rebuild' is 55 lines long (max 50)
game/core/effect_engine.gd|quality/max-local-variables|function 'validate_trigger_row' has 11 local variables (max 10)
game/core/effect_engine.gd|quality/max-nesting-depth|function '_cond_ok' has nesting depth 5 (max 4)
game/core/effect_engine.gd|quality/max-nesting-depth|function 'rebuild' has nesting depth 5 (max 4)
game/core/effect_engine.gd|quality/max-returns|function '_cond_ok' has 19 return statements (max 6)
game/core/effect_engine.gd|quality/no-else-return|unnecessary 'elif' after 'return'
game/core/level_runner.gd|quality/max-class-variables|class has 40 variables (max 15)
game/core/level_runner.gd|quality/max-file-length|file is 1013 lines long (max 1000)
game/core/level_runner.gd|quality/max-parameters|function 'start_level_external' has 8 parameters (max 5)
game/core/level_runner.gd|quality/max-public-methods|class has 54 public methods (max 20)
game/core/level_runner.gd|quality/max-returns|function '_enter_node' has 7 return statements (max 6)
game/core/meta_progression.gd|quality/max-public-methods|class has 31 public methods (max 20)
game/core/meta_progression.gd|quality/max-returns|function 'tree_can_buy' has 8 return statements (max 6)
game/core/minesweeper_rules.gd|quality/max-function-length|function '_do_dig' is 53 lines long (max 50)
game/core/node_map_generator.gd|quality/max-branches|function '_assign_types' has 11 branches (max 8)
game/core/node_map_generator.gd|quality/max-branches|function 'check_params' has 12 branches (max 8)
game/core/node_map_generator.gd|quality/max-branches|function 'validate_output' has 34 branches (max 8)
game/core/node_map_generator.gd|quality/max-function-length|function 'validate_output' is 132 lines long (max 50)
game/core/node_map_generator.gd|quality/max-local-variables|function '_add_forks' has 12 local variables (max 10)
game/core/node_map_generator.gd|quality/max-local-variables|function '_build' has 15 local variables (max 10)
game/core/node_map_generator.gd|quality/max-local-variables|function 'validate_output' has 22 local variables (max 10)
game/core/node_map_generator.gd|quality/max-nesting-depth|function '_check_fork_rules' has nesting depth 5 (max 4)
game/core/node_map_generator.gd|quality/max-returns|function 'validate_output' has 7 return statements (max 6)
game/core/reward_economy.gd|quality/max-function-length|function 'roll_board' is 54 lines long (max 50)
game/core/reward_economy.gd|quality/max-local-variables|function '_skewed_cell_rows' has 13 local variables (max 10)
game/core/reward_economy.gd|quality/max-local-variables|function 'roll_board' has 11 local variables (max 10)
game/core/save_manager.gd|quality/max-public-methods|class has 52 public methods (max 20)
game/core/save_manager.gd|quality/max-returns|function '_peek_summary_at' has 7 return statements (max 6)
game/core/save_manager.gd|quality/max-returns|function 'load_from_disk' has 8 return statements (max 6)
game/core/settlement/combat_segment.gd|quality/max-function-length|function 'run' is 83 lines long (max 50)
game/core/settlement/combat_segment.gd|quality/max-local-variables|function 'run' has 13 local variables (max 10)
game/core/settlement/grant_segment.gd|quality/max-branches|function '_judge_seal' has 14 branches (max 8)
game/core/settlement/grant_segment.gd|quality/max-branches|function 'run' has 33 branches (max 8)
game/core/settlement/grant_segment.gd|quality/max-function-length|function '_judge_seal' is 84 lines long (max 50)
game/core/settlement/grant_segment.gd|quality/max-function-length|function 'run' is 211 lines long (max 50)
game/core/settlement/grant_segment.gd|quality/max-local-variables|function '_judge_seal' has 11 local variables (max 10)
game/core/settlement/grant_segment.gd|quality/max-local-variables|function 'run' has 36 local variables (max 10)
game/core/settlement/grant_segment.gd|quality/max-nesting-depth|function '_judge_seal' has nesting depth 6 (max 4)
game/core/settlement/grant_segment.gd|quality/max-nesting-depth|function 'run' has nesting depth 6 (max 4)
game/core/status_container.gd|quality/max-nesting-depth|function 'apply_effect' has nesting depth 5 (max 4)
game/core/status_container.gd|quality/max-parameters|function '_new_instance' has 7 parameters (max 5)
game/core/status_container.gd|quality/max-returns|function 'apply_effect' has 9 return statements (max 6)
game/core/treasure_items.gd|quality/max-branches|function 'validate_use' has 11 branches (max 8)
game/core/treasure_items.gd|quality/max-nesting-depth|function 'validate_use' has nesting depth 5 (max 4)
game/core/unit_container.gd|quality/max-function-length|function 'spawn' is 81 lines long (max 50)
game/core/unit_container.gd|quality/max-local-variables|function 'spawn' has 17 local variables (max 10)
game/core/unit_container.gd|quality/max-parameters|function 'spawn' has 10 parameters (max 5)
game/data/schemas/adventure_table.gd|quality/max-class-variables|class has 44 variables (max 15)
game/data/schemas/board_gen_table.gd|quality/max-branches|function 'validate' has 20 branches (max 8)
game/data/schemas/board_gen_table.gd|quality/max-function-length|function 'validate' is 67 lines long (max 50)
game/data/schemas/board_gen_table.gd|quality/max-local-variables|function 'validate' has 16 local variables (max 10)
game/data/schemas/enemy_table.gd|quality/max-branches|function 'validate' has 32 branches (max 8)
game/data/schemas/enemy_table.gd|quality/max-function-length|function 'validate' is 116 lines long (max 50)
game/data/schemas/enemy_table.gd|quality/max-local-variables|function 'validate' has 29 local variables (max 10)
game/data/schemas/forge_table.gd|quality/max-branches|function 'validate' has 30 branches (max 8)
game/data/schemas/forge_table.gd|quality/max-function-length|function 'validate' is 95 lines long (max 50)
game/data/schemas/forge_table.gd|quality/max-local-variables|function 'validate' has 20 local variables (max 10)
game/data/schemas/level_gen_params.gd|quality/max-branches|function 'validate' has 15 branches (max 8)
game/data/schemas/level_gen_params.gd|quality/max-function-length|function 'validate' is 59 lines long (max 50)
game/data/schemas/level_gen_params.gd|quality/max-local-variables|function 'validate' has 18 local variables (max 10)
game/data/schemas/level_table.gd|quality/max-branches|function '_validate_graph' has 21 branches (max 8)
game/data/schemas/level_table.gd|quality/max-branches|function '_validate_level_nodes' has 12 branches (max 8)
game/data/schemas/level_table.gd|quality/max-function-length|function '_validate_graph' is 99 lines long (max 50)
game/data/schemas/level_table.gd|quality/max-local-variables|function '_validate_graph' has 19 local variables (max 10)
game/data/schemas/meta_table.gd|quality/max-branches|function 'validate' has 14 branches (max 8)
game/data/schemas/meta_table.gd|quality/max-function-length|function 'validate' is 60 lines long (max 50)
game/data/schemas/meta_table.gd|quality/max-local-variables|function 'validate' has 14 local variables (max 10)
game/data/schemas/meta_tree_table.gd|quality/max-branches|function 'validate' has 26 branches (max 8)
game/data/schemas/meta_tree_table.gd|quality/max-function-length|function 'validate' is 86 lines long (max 50)
game/data/schemas/meta_tree_table.gd|quality/max-local-variables|function 'validate' has 13 local variables (max 10)
game/data/schemas/meta_tree_table.gd|quality/max-nesting-depth|function 'validate' has nesting depth 5 (max 4)
game/data/schemas/reward_table.gd|quality/max-branches|function 'validate' has 30 branches (max 8)
game/data/schemas/reward_table.gd|quality/max-function-length|function 'validate' is 99 lines long (max 50)
game/data/schemas/reward_table.gd|quality/max-local-variables|function 'validate' has 20 local variables (max 10)
game/data/schemas/settlement_table.gd|quality/max-branches|function 'validate' has 16 branches (max 8)
game/data/schemas/settlement_table.gd|quality/max-class-variables|class has 18 variables (max 15)
game/data/schemas/shop_table.gd|quality/max-branches|function 'validate' has 22 branches (max 8)
game/data/schemas/shop_table.gd|quality/max-function-length|function 'validate' is 84 lines long (max 50)
game/data/schemas/shop_table.gd|quality/max-local-variables|function 'validate' has 20 local variables (max 10)
game/data/schemas/skill_table.gd|quality/max-branches|function 'validate' has 29 branches (max 8)
game/data/schemas/skill_table.gd|quality/max-function-length|function 'validate' is 80 lines long (max 50)
game/data/schemas/status_effect_table.gd|quality/max-branches|function 'validate' has 12 branches (max 8)
game/data/schemas/treasure_item_table.gd|quality/max-branches|function 'validate' has 44 branches (max 8)
game/data/schemas/treasure_item_table.gd|quality/max-function-length|function 'validate' is 147 lines long (max 50)
game/data/schemas/treasure_item_table.gd|quality/max-local-variables|function 'validate' has 26 local variables (max 10)
game/data/schemas/treasure_item_table.gd|quality/max-nesting-depth|function 'validate' has nesting depth 6 (max 4)
game/data/schemas/variation_table.gd|quality/max-branches|function 'validate' has 20 branches (max 8)
game/data/schemas/variation_table.gd|quality/max-function-length|function 'validate' is 58 lines long (max 50)
game/presentation/battle_narrator.gd|quality/max-returns|function 'bonus_card_text' has 9 return statements (max 6)
game/presentation/camp_flow_context.gd|quality/max-parameters|function '_init' has 12 parameters (max 5)
game/presentation/curio_flow_context.gd|quality/max-class-variables|class has 16 variables (max 15)
game/presentation/curio_flow_context.gd|quality/max-parameters|function '_init' has 16 parameters (max 5)
game/presentation/curio_interact_controller.gd|quality/max-class-variables|class has 18 variables (max 15)
game/presentation/hud_presenter.gd|quality/max-parameters|function '_refresh_out_of_battle' has 6 parameters (max 5)
game/presentation/hud_presenter.gd|quality/max-parameters|function 'refresh' has 8 parameters (max 5)
game/presentation/hud_presenter.gd|quality/max-parameters|function 'tune_sim_report' has 10 parameters (max 5)
game/presentation/main.gd|quality/max-class-variables|class has 49 variables (max 15)
game/presentation/main.gd|quality/max-file-length|file is 1509 lines long (max 1000)
game/presentation/main.gd|quality/max-function-length|function '_build_ui' is 189 lines long (max 50)
game/presentation/playtest_logger.gd|quality/no-debug-print|debug 'print()' call found
game/presentation/treasure_interact_controller.gd|quality/max-local-variables|function 'inventory_projection' has 11 local variables (max 10)
game/presentation/treasure_interact_controller.gd|quality/max-parameters|function '_init' has 7 parameters (max 5)
game/presentation/tune_sim_controller.gd|quality/await-in-loop|'await' used inside a loop
game/presentation/tune_sim_controller.gd|quality/max-local-variables|function 'run' has 11 local variables (max 10)
game/presentation/tune_sim_controller.gd|quality/no-debug-print|debug 'print()' call found
game/presentation/ui_assembler.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/ui_assembler.gd|quality/max-function-length|function 'build_start_overlay' is 83 lines long (max 50)
game/presentation/ui_assembler.gd|quality/max-local-variables|function 'build_start_overlay' has 16 local variables (max 10)
game/presentation/views/ap_bar_view.gd|quality/max-function-length|function '_init' is 69 lines long (max 50)
game/presentation/views/battle_end_overlay.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/battle_end_overlay.gd|quality/max-class-variables|class has 20 variables (max 15)
game/presentation/views/battle_end_overlay.gd|quality/max-function-length|function '_init' is 81 lines long (max 50)
game/presentation/views/battle_end_overlay.gd|quality/max-parameters|function 'open_victory' has 8 parameters (max 5)
game/presentation/views/battle_log_view.gd|quality/max-branches|function '_format_row' has 9 branches (max 8)
game/presentation/views/battle_log_view.gd|quality/max-function-length|function '_format_row' is 68 lines long (max 50)
game/presentation/views/battle_log_view.gd|quality/max-local-variables|function '_format_row' has 21 local variables (max 10)
game/presentation/views/battle_log_view.gd|quality/max-returns|function '_format_row' has 13 return statements (max 6)
game/presentation/views/battle_stage_view.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/battle_stage_view.gd|quality/max-function-length|function '_init' is 97 lines long (max 50)
game/presentation/views/battle_stage_view.gd|quality/max-returns|function '_enemy_portrait_tex' has 9 return statements (max 6)
game/presentation/views/board_cell_unit.gd|quality/max-branches|function '_draw' has 29 branches (max 8)
game/presentation/views/board_cell_unit.gd|quality/max-class-variables|class has 31 variables (max 15)
game/presentation/views/board_cell_unit.gd|quality/max-function-length|function '_draw' is 147 lines long (max 50)
game/presentation/views/board_cell_unit.gd|quality/max-local-variables|function '_draw' has 19 local variables (max 10)
game/presentation/views/board_fx_view.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/board_view.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/board_view.gd|quality/max-branches|function '_paint_cell' has 24 branches (max 8)
game/presentation/views/board_view.gd|quality/max-branches|function '_wall_tile_for' has 14 branches (max 8)
game/presentation/views/board_view.gd|quality/max-class-variables|class has 45 variables (max 15)
game/presentation/views/board_view.gd|quality/max-file-length|file is 1220 lines long (max 1000)
game/presentation/views/board_view.gd|quality/max-function-length|function '_paint_cell' is 139 lines long (max 50)
game/presentation/views/board_view.gd|quality/max-local-variables|function '_digit_ink_mode' has 12 local variables (max 10)
game/presentation/views/board_view.gd|quality/max-local-variables|function '_paint_cell' has 22 local variables (max 10)
game/presentation/views/board_view.gd|quality/max-public-methods|class has 27 public methods (max 20)
game/presentation/views/board_view.gd|quality/max-returns|function '_wall_center_tile' has 7 return statements (max 6)
game/presentation/views/board_view.gd|quality/max-returns|function '_wall_tile_for' has 15 return statements (max 6)
game/presentation/views/board_zone_view.gd|quality/max-function-length|function '_init' is 59 lines long (max 50)
game/presentation/views/camp_overlay_view.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/camp_overlay_view.gd|quality/max-class-variables|class has 19 variables (max 15)
game/presentation/views/camp_overlay_view.gd|quality/max-function-length|function '_init' is 149 lines long (max 50)
game/presentation/views/camp_overlay_view.gd|quality/max-function-length|function '_rebuild_forge' is 72 lines long (max 50)
game/presentation/views/camp_overlay_view.gd|quality/max-function-length|function '_rebuild_tree' is 61 lines long (max 50)
game/presentation/views/camp_overlay_view.gd|quality/max-function-length|function 'refresh_camp' is 61 lines long (max 50)
game/presentation/views/camp_overlay_view.gd|quality/max-local-variables|function '_init' has 28 local variables (max 10)
game/presentation/views/camp_overlay_view.gd|quality/max-local-variables|function '_rebuild_forge' has 20 local variables (max 10)
game/presentation/views/camp_overlay_view.gd|quality/max-local-variables|function '_rebuild_tree' has 21 local variables (max 10)
game/presentation/views/camp_overlay_view.gd|quality/max-local-variables|function 'refresh_camp' has 17 local variables (max 10)
game/presentation/views/curio_pick_overlay.gd|quality/max-function-length|function '_init' is 52 lines long (max 50)
game/presentation/views/curio_pick_overlay.gd|quality/max-returns|function '_icon_for_id' has 7 return statements (max 6)
game/presentation/views/debug_overlay.gd|quality/max-class-variables|class has 17 variables (max 15)
game/presentation/views/debug_overlay.gd|quality/max-function-length|function '_build' is 124 lines long (max 50)
game/presentation/views/debug_overlay.gd|quality/max-local-variables|function '_build' has 22 local variables (max 10)
game/presentation/views/hero_info_panel_view.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/hero_info_panel_view.gd|quality/max-function-length|function '_init' is 74 lines long (max 50)
game/presentation/views/hero_info_panel_view.gd|quality/max-function-length|function 'set_treasure_inventory' is 57 lines long (max 50)
game/presentation/views/hero_info_panel_view.gd|quality/max-local-variables|function 'set_treasure_inventory' has 13 local variables (max 10)
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|function '_draw_graph' has 9 branches (max 8)
game/presentation/views/level_map_screen.gd|quality/max-class-variables|class has 21 variables (max 15)
game/presentation/views/level_map_screen.gd|quality/max-function-length|function '_draw_graph' is 78 lines long (max 50)
game/presentation/views/level_map_screen.gd|quality/max-function-length|function '_init' is 135 lines long (max 50)
game/presentation/views/level_map_screen.gd|quality/max-local-variables|function '_draw_graph' has 27 local variables (max 10)
game/presentation/views/level_map_screen.gd|quality/max-local-variables|function '_init' has 21 local variables (max 10)
game/presentation/views/settings_overlay.gd|quality/max-function-length|function '_build' is 77 lines long (max 50)
game/presentation/views/settings_overlay.gd|quality/max-local-variables|function '_build' has 13 local variables (max 10)
game/presentation/views/standee_body.gd|quality/allocation-in-loop|object allocation '.new()' inside a loop
game/presentation/views/standee_body.gd|quality/max-class-variables|class has 29 variables (max 15)
game/presentation/views/standee_body.gd|quality/max-function-length|function '_draw' is 84 lines long (max 50)
game/presentation/views/standee_body.gd|quality/max-local-variables|function '_draw' has 26 local variables (max 10)
game/presentation/views/ui_kit.gd|quality/max-local-variables|function 'beams_rect' has 13 local variables (max 10)
game/presentation/views/ui_kit.gd|quality/max-parameters|function '_init' has 6 parameters (max 5)
game/presentation/views/ui_kit.gd|quality/max-parameters|function 'bcard' has 6 parameters (max 5)
game/presentation/views/ui_kit.gd|quality/max-parameters|function 'modal_shell' has 6 parameters (max 5)
game/presentation/views/ui_kit.gd|quality/max-public-methods|class has 26 public methods (max 20)
+117
View File
@@ -0,0 +1,117 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""gdstyle_gate.py — S13 第三方质量规则闸件(game/tests/static_scan.sh 调用)
跑 gdstyle(github.com/atelico/gdstyle,Rust 单二进制,版本钉 v0.4.0)质量规则扫描,
与存量基线 tools/gdstyle_baseline.txt 做差集——只有基线外的新违规才红。
规则口径见 tools/gdstyle.toml 头注(只开 quality/*+syntax/reserved-identifier,
format/naming/order 全关)。扫描面=产品码三目录(game/core、game/data、game/presentation,
与 S9 类型闸同口径——probe/sim/tests 测量面直构惯例不在面)。
基线键=文件|规则|消息 三元组:消息含违规对象标识(如 duplicated load 的路径),行漂移稳定
(gdstyle 的 JSON 输出不含源码行文本,行号键会随编辑成片假红)。基线重生成=人工专用
(--refresh),禁在闸内自动重生成(防清基线换绿)。
二进制:本机固定路径 D:/code/gdstyle/gdstyle.exe(不入库不入包),GDSTYLE_BIN 环境变量覆盖;
版本与钉定版不符即红——升级工具须重测语法兼容性并人工重生成基线。
退出码:0=无基线外新违规;1=有新违规/二进制缺失或版本不符/扫描面为空/输出不可解析;2=用法错。
用法:python tools/gdstyle_gate.py # 闸判定
python tools/gdstyle_gate.py --refresh # 人工重生成基线(覆盖旧文件)
"""
import json
import os
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
CONFIG = ROOT / "tools" / "gdstyle.toml"
BASELINE = ROOT / "tools" / "gdstyle_baseline.txt"
SCAN_DIRS = ["game/core", "game/data", "game/presentation"]
PINNED_VERSION = "0.4.0"
DEFAULT_BIN = "D:/code/gdstyle/gdstyle.exe"
MAX_REPORT = 50
def fail(msg: str) -> int:
print("[gdstyle_gate] FAIL — %s" % msg)
return 1
def run_gate() -> int:
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
refresh = "--refresh" in sys.argv[1:]
if sys.argv[1:] and not refresh:
print("[gdstyle_gate] 用法: python tools/gdstyle_gate.py [--refresh]")
return 2
binary = os.environ.get("GDSTYLE_BIN", DEFAULT_BIN)
try:
ver = subprocess.run([binary, "--version"], capture_output=True, text=True, timeout=30)
except (FileNotFoundError, OSError):
return fail("gdstyle 二进制不可用:%s(本机固定路径,GDSTYLE_BIN 可覆盖;"
"v%s Windows 版见 github.com/atelico/gdstyle releases)" % (binary, PINNED_VERSION))
if PINNED_VERSION not in (ver.stdout or ""):
return fail("gdstyle 版本不符:钉定 v%s,实得 %r——升级工具须重测语法兼容性并人工重生成基线"
% (PINNED_VERSION, (ver.stdout or "").strip()))
face = [p for d in SCAN_DIRS for p in Path(ROOT, d).rglob("*.gd")]
if not face:
return fail("扫描面为空——%s 下零个 .gd(路径写错导致的静默空转)" % "、".join(SCAN_DIRS))
try:
proc = subprocess.run(
[binary, "check", "--format", "json", "--no-color", "-c", str(CONFIG)] + SCAN_DIRS,
capture_output=True, text=True, timeout=300, cwd=str(ROOT), encoding="utf-8",
)
except subprocess.TimeoutExpired:
return fail("gdstyle 扫描超时(300s)")
try:
findings = json.loads(proc.stdout or "[]")
except json.JSONDecodeError:
return fail("gdstyle 输出不可解析为 JSON(stderr 头部:%r)" % (proc.stderr or "")[:200])
keys = set()
for f in findings:
if not isinstance(f, dict) or "rule" not in f:
continue
file_path = str(f.get("file", "")).replace("\\", "/")
keys.add("%s|%s|%s" % (file_path, f["rule"], f.get("message", "")))
if refresh:
lines = [
"# gdstyle 存量基线(S13)——文件|规则|消息 三元组,每行一条;只记基线不记豁免理由。",
"# 重生成=人工专用:python tools/gdstyle_gate.py --refresh(禁清基线换绿;改规则口径/工具升级须随批重生成)。",
]
lines += sorted(keys)
BASELINE.write_text("\n".join(lines) + "\n", encoding="utf-8")
print("[gdstyle_gate] 基线已重生成:%s 条(%s)" % (len(keys), BASELINE.name))
return 0
base = set()
if BASELINE.exists():
for line in BASELINE.read_text(encoding="utf-8").splitlines():
s = line.strip()
if s and not s.startswith("#"):
base.add(s)
else:
return fail("基线文件不存在:%s(首次落位跑 python tools/gdstyle_gate.py --refresh,须经用户批准)" % BASELINE.name)
new = sorted(keys - base)
print("[gdstyle_gate] 扫描面 %d 个 .gd;命中 %d 条,基线内 %d 条,基线外新违规 %d 条"
% (len(face), len(keys), len(keys & base), len(new)))
if new:
for k in new[:MAX_REPORT]:
print(" NEW " + k)
if len(new) > MAX_REPORT:
print(" ...(截断,共 %d 条)" % len(new))
return fail("基线外新违规 %d 条——新码须修到基线口径内,或经用户批准随批重生成基线" % len(new))
print("[gdstyle_gate] ok")
return 0
if __name__ == "__main__":
sys.exit(run_gate())