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

Abierto Apto para principiantes
#101 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
testing, tooling

Línea de trabajo

Lee la lógica de validación en src/lint/rules/removed-api-usage.ts:98-116 y los casos relacionados en test/removed-api.test.ts. Ejecuta la reproducción reportada y luego añade una prueba para un destino inferido combinado con un fromVersion explícito. El objetivo se cumple cuando el caso ya no aborta el lint con el código de salida 2 y satisface uno de los criterios de aceptación indicados; ejecuta npm run build && npm test.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
0
Forks
6
Merge medio
1 d 21 h
PR fusionados (30 d)
8

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TMHSDigital/godot-correctness-mcp

Todos los issues de TMHSDigital/godot-correctness-mcp

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.