scene-node-path-missing false positive for $Path inside an inner class

未关闭 适合新手
#105 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
testing-qa

调研方向

Read src/scenes/node-paths.ts around lines 31–49 to see how pathUses walks class definitions, then review the related cases in test/node-paths.test.ts. Run npm run build && npm test to check the behavior; done means the inner-class $Label repro reports no warning while a top-level $Missing still does.

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

描述

bug good first issue severity: medium

Summary

scene-node-path-missing resolves $Path and get_node("...") literals inside inner classes (class Helper extends Node:) against the scene node the outer script is attached to. Those paths refer to the inner class instance's children, so the warning is a false positive.

Where

  • src/scenes/node-paths.ts:31-49 (pathUses walks the whole tree, including class_definition bodies)

Steps to reproduce

  1. Create main.tscn with root Main (script main.gd, extends Node2D) and one child, Sprite.
  2. In main.gd:
    class Helper extends Node:
        func f() -> void:
            $Label.show()
    
  3. gdcorrect validate-scenes . reports WARNING scene-node-path-missing Node path "Label" does not exist under this script's node.

Impact

Scripts that nest Node subclasses get spurious warnings, and --fail-on warning turns them into CI failures.

Suggested fix

In pathUses, do not descend into class_definition nodes. Only the top-level class body is attached to the scene node.

Acceptance criteria

  • The repro reports nothing.
  • A top-level $Missing still reports.

Getting started

  • Relevant files: src/scenes/node-paths.ts, test/node-paths.test.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: S. audit-key: bug|src/scenes/node-paths.ts|pathUses

主要语言
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 摘要。