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

Đang mở Phù hợp với người mới
#105 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
0
Fork
6
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TMHSDigital/godot-correctness-mcp

Tất cả issue của TMHSDigital/godot-correctness-mcp

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.