removed-api-usage: fromVersion-only config now fails every lint (exit 2)

Ouverte Adaptée aux débutants
#101 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
82/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
node.js, typescript
Domaine
testing, tooling

Piste de recherche

Lisez la logique de validation dans src/lint/rules/removed-api-usage.ts:98-116 et les cas associés dans test/removed-api.test.ts. Exécutez la reproduction signalée, puis ajoutez un test pour une cible déduite combinée à un fromVersion explicite. Le travail est terminé lorsque ce cas n’interrompt plus le lint avec le code de sortie 2 et satisfait l’un des critères d’acceptation indiqués ; exécutez npm run build && npm test.

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

Description

bug good first issue severity: medium

Summary

Since removed-api-usage infers targetVersion from project.godot (#91), a config that sets only options.fromVersion makes every lint run fail with exit 2, when the inferred target equals that fromVersion. The error message names targetVersion, an option the user never set.

Where

  • src/lint/rules/removed-api-usage.ts:98-116

Details

const target = ctx.options["targetVersion"] ?? pinnedVersionFor(ctx.projectGodotVersion ?? null);
...
const fromOpt = ctx.options["fromVersion"];
if (fromOpt !== undefined) {
  const others = PINNED_GODOT_VERSIONS.filter((v) => v !== target);
  if (typeof fromOpt !== "string" || !(others as readonly string[]).includes(fromOpt)) {
    throw new Error(`removed-api-usage: options.fromVersion must be one of ... when targetVersion is ${target} ...`);

Before #91 the rule was simply off without targetVersion, so {"fromVersion": "4.4"} was harmless. Now a project that declares 4.4 infers target = "4.4", and others is ["4.5"]. fromVersion: "4.4" is rejected and the rule throws, which aborts the run.

Impact

Existing configs that pre-set fromVersion (for example, to prepare for an upgrade) break CI with exit 2 after upgrading gdcorrect. The same happens if a project's declared version later changes to match fromVersion.

Steps to reproduce

  1. Set project.godot config/features=PackedStringArray("4.4", ...).
  2. Use the config {"rules": {"removed-api-usage": {"options": {"fromVersion": "4.4"}}}}.
  3. Run gdcorrect lint <project>: exit 2 with the message above.

Suggested fix

When targetVersion was inferred, not configured, and equals fromVersion, skip the rule (nothing to compare) instead of throwing. Otherwise mention the inference in the message, for example "targetVersion 4.4 (inferred from project.godot)".

Acceptance criteria

  • The repro returns no removed-api-usage findings and exit 0, or a clear message that names the inferred version.
  • A test covers an inferred target combined with an explicit fromVersion.

Getting started

  • Relevant files: src/lint/rules/removed-api-usage.ts, test/removed-api.test.ts
  • How to run tests: npm run build && npm test

Related: #91


Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: S. audit-key: bug|src/lint/rules/removed-api-usage.ts|fromVersion

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.