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

Offen Anfängerfreundlich
#101 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript
Bereich
testing, tooling

Rechercherichtung

Lies die Validierungslogik unter src/lint/rules/removed-api-usage.ts:98-116 und die zugehörigen Fälle in test/removed-api.test.ts. Führe die gemeldete Reproduktion aus und füge dann einen Test für ein abgeleitetes Ziel in Kombination mit einem expliziten fromVersion hinzu. Das Ziel ist erreicht, wenn der Fall den Lint-Lauf nicht mehr mit Exit-Code 2 abbricht und eines der genannten Abnahmekriterien erfüllt; führe npm run build && npm test aus.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
TypeScript
Sterne
0
Forks
6
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
8

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/godot-correctness-mcp

Alle Issues in TMHSDigital/godot-correctness-mcp

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.