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

Ouverte
#118 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é
4/5
Temps estimé
1-2 jours
Accessibilité débutants
72/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
tooling

Piste de recherche

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.

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

Description

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

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.