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

Aperta Adatta ai principianti
#105 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing-qa

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
0
Fork
6
Merge medio
1g 21h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/godot-correctness-mcp

Tutte le issue di TMHSDigital/godot-correctness-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.