Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Measure test strength with mutation testing and stop encoding current behavior as specification

Aperta
#86 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
ci-cd, testing-qa

Direzione di ricerca

Start with pkg/reportdiff/compare_test.go and TestLanguagePercentagesRetainTheirDenominatorAndLimits, then review the core package list and the Enry and go-git paths named in the proposal. Run the existing reportdiff and CLI tests to identify behavior-as-spec and silence assertions. Done means on-demand and pre-release mutation runs, tracked package results, audited tests, and diagnostic-code tables including valid-input-no-warning cases.

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

Descrizione

enhancement follow-up

Why

82.6% statement coverage says which lines ran, not whether any assertion would notice them being wrong. Two findings from 2026-09-22 show the gap:

  • Tests that encode current behavior as the specification. TestLanguagePercentagesRetainTheirDenominatorAndLimits (pkg/reportdiff/compare_test.go) asserts Unavailable == 1 when a language appears only in the newer report. That is exactly the #10 defect (added languages reported as "unavailable"), so fixing the bug would fail the test.
  • "Silence" assertions. Many CLI tests check stderr == "" rather than asserting the specific warning codes the contract promises. A wrong warning, such as the false unsupported_gitattributes for a pattern-only line, can only be caught by an assertion that expects particular diagnostics.

Proposal

  • Mutation testing (e.g. gremlins or go-mutesting) on the core packages:
    • pkg/scanner, pkg/declarations, pkg/projects, pkg/reportdiff, pkg/environments;
    • the Enry fork's strategy chain and heuristics (third_party/go-enry/common.go, data/);
    • the go-git fork's patched read path.
    • Publish mutation scores per package, and triage surviving mutants into new assertions.
  • Spec-referenced tests. Every test that pins behavior modeled on an external system (Linguist, Git, Cargo, npm, PEP 508/440, MSBuild, SARIF) cites the governing source: gem file and line, Git docs, the Cargo reference. A test that encodes a known limitation must say so and link its issue, so that fixing the limitation is an expected test change, not a surprise.
  • Diagnostics are contract. For each module, table tests assert exact warning and diagnostic codes, both positive and negative, including "this valid input produces no warning".

Acceptance

  • Mutation testing runs on demand (workflow_dispatch or a local make target) and before releases, with results tracked over time. Nothing runs on a schedule (#92). No hard gate at first; set a floor per core package once there's a baseline.
  • An audit of existing tests for behavior-as-spec assertions, starting with the reportdiff language test above, with each one either re-specified or linked to its issue.
  • Every module has diagnostic-code table tests, including valid-input-no-warning cases (a pattern-only .gitattributes line; Cargo { workspace = true, default-features = false }).

Part of the 1.0 quality program: #83. Epic: #81.

Lingua principale
Go
Stelle
0
Fork
0
Merge medio
5h 8m
PR unite (30g)
54

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 war-and-code/dircue

Tutte le issue di war-and-code/dircue

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.