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

Ouverte Adaptée aux débutants
#105 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
84/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
testing-qa

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
TypeScript
Étoiles
0
Forks
6
Merge moyen
1 j 21 h
PR mergées (30 j)
8

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TMHSDigital/godot-correctness-mcp

Toutes les issues de TMHSDigital/godot-correctness-mcp

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.