Scene/project rule ids are free strings with no check against the catalogue

未关闭
#118 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

Start with src/lint/catalog.ts and src/scenes/validate.ts, then trace the rule emitters named in the issue and the catalogue checks in src/lint/config.ts and src/lint/engine.ts. Run npm run build && npm test to establish the current behavior. Done when scene, project, and registry rule IDs are checked against the catalogue by TypeScript and their severities default from it.

由索引模型根据 Issue 内容生成。

描述

severity: low tech-debt

Summary

Scene, project and registry checks emit ruleId as free strings, while SCENE_RULES in the catalogue lists the same ids by hand. Nothing ties the two together.

Where

  • src/lint/catalog.ts:15-40 (SCENE_RULES: untyped tuples cast with as)
  • src/scenes/validate.ts:20-29 (finding(..., ruleId: string, ...)), plus the emitters in src/scenes/scene-graph.ts, src/scenes/node-paths.ts and src/scenes/input-actions.ts
  • src/lint/config.ts:37-41 (config rejects ids missing from RULE_INFO); src/lint/engine.ts:39 (routes on SCENE_RULE_IDS)

Why it hurts now

Adding a scene or project check means editing 2 to 3 files. A typo, or a forgotten catalogue entry, produces a rule that:

  • users cannot configure ("Unknown rule id"),
  • list_rules and the docs omit,
  • the lint engine may route wrongly.

TypeScript catches none of this. The two lists are in sync today (checked with grep), but only by hand.

Plan (each step leaves the code working)

  1. Add a test that greps src/scenes/** for (scene|project|registry)-[a-z-]+ ids passed to finding( and asserts each one is in RULE_INFO.
  2. Turn SCENE_RULES into an as const object keyed by id, and derive type SceneRuleId. Remove the as casts.
  3. Change finding() and the other emitters to take ruleId: SceneRuleId, and default the severity from the catalogue.
  4. Once the compiler enforces it, drop the step-1 test.

Getting started

  • Relevant files: src/lint/catalog.ts, src/scenes/validate.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: low. Effort: S. audit-key: tech-debt|src/lint/catalog.ts|SCENE_RULES

主要语言
TypeScript
星标
0
派生
6
平均合并
1 天 21 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/godot-correctness-mcp 的其他 Issue

查看 TMHSDigital/godot-correctness-mcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。