--baseline with --files/--changed-since reports unlinted entries as stale

Aperta Adatta ai principianti
#106 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
cli, testing

Direzione di ricerca

Leggi src/baseline.ts intorno a applyBaseline e src/cli.ts intorno alle righe 364–380 per ricostruire come i file circoscritti arrivano al conteggio della baseline. Poi esamina test/cli.test.ts ed esegui la riproduzione segnalata con --files; il lavoro è completato quando i file senza lint sono esclusi dal conteggio degli elementi obsoleti e il test conferma che non ci sono voci obsolete.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue severity: low

Summary

gdcorrect lint --baseline b.json --files ... (or --changed-since) counts every baseline entry for files that were not linted as "stale (fixed)", and tells the user they can be removed by rewriting the baseline.

Where

  • src/cli.ts:364-380
  • src/baseline.ts:101 (stale = every entry no finding consumed)

Details

applyBaseline has no idea the run was narrowed, so entries for unlinted files are never consumed. The stderr message then says "N baseline entries are stale (fixed) and can be removed by rewriting it", and staleBaselineEntries in the JSON is inflated by the same amount. --write-baseline with narrowing is (correctly) refused, so the message pushes users toward a full rewrite they do not need.

Impact

On pre-commit and PR runs, the main use of --changed-since, the stale count is misleading and grows with the size of the baseline.

Steps to reproduce

  1. Create a 3-file project with one finding per file and run gdcorrect lint p --write-baseline b.json.
  2. Run gdcorrect lint p --files p/a.gd --baseline b.json.
  3. stderr says "1 finding(s) matched the baseline; 2 baseline entries are stale (fixed)...".

Suggested fix

Pass the narrowed file set into applyBaseline, and count only stale entries whose file is in it.

Acceptance criteria

  • The repro reports 0 stale entries.
  • A test covers --baseline combined with --files.

Getting started

  • Relevant files: src/baseline.ts, src/cli.ts, test/cli.test.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: low. Effort: S. audit-key: bug|src/cli.ts|baseline+narrowed

Lingua principale
TypeScript
Stelle
0
Fork
6
Merge medio
1g 21h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/godot-correctness-mcp

Tutte le issue di TMHSDigital/godot-correctness-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.