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

Aberta Para iniciantes
#101 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
82/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
node.js, typescript
Domínio
testing, tooling

Direção de pesquisa

Leia a lógica de validação em src/lint/rules/removed-api-usage.ts:98-116 e os casos relacionados em test/removed-api.test.ts. Execute a reprodução relatada e, em seguida, adicione um teste para um destino inferido combinado com um fromVersion explícito. O trabalho estará concluído quando o caso não abortar mais o lint com código de saída 2 e atender a um dos critérios de aceitação indicados; execute npm run build && npm test.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
0
Forks
6
Merge médio
1d 21h
PRs com merge (30d)
8

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TMHSDigital/godot-correctness-mcp

Todas as issues de TMHSDigital/godot-correctness-mcp

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.