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

code-metrics yaml_subset.py: quote mid-value swallows comments; duplicate key in a sequence item reports the wrong line

Aperta Adatta ai principianti
#6,699 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
devtools

Direzione di ricerca

I due bug si trovano in plugins/code-metrics/scripts/yaml_subset.py, nella logica di rimozione dei commenti (dove un apice apre una stringa) e nel controllo delle chiavi duplicate per gli elementi di sequenza. Il port JavaScript in plugins/user-experience/scripts/lib/yaml-subset.mjs, corretto nel commit 1d5a3fca3f, mostra il comportamento previsto, e i suoi test si trovano in plugins/user-experience/tests/yaml-subset.test.mjs. Scrivi prima test Python che falliscono per title: it's fine # comment e per l'input con chiave duplicata - job: a. È completato quando entrambi riproducono l'errore, entrambi passano dopo la correzione e i test esistenti di yaml_subset.py continuano a passare.

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

Descrizione

good first issue needs-triage priority: low

No related issue: found while porting the parser for #6306 (PR #6669).

Problem

plugins/code-metrics/scripts/yaml_subset.py likely has two bugs that its JavaScript port in plugins/user-experience/scripts/lib/yaml-subset.mjs had and fixed in #6669:

  1. A quote mid-value swallows a trailing comment. stripComment treats any ' or " as the start of a quoted string, even inside a plain value, so title: it's fine # comment parses as "it's fine # comment" instead of "it's fine".
  2. A duplicate key inside a sequence item is reported on the wrong line. For - job: a\n id: x\n job: b\n, the error names line 1 (the dash line) instead of line 3.

The port fixed both in 1d5a3fca3f: a quote opens only where a value starts (line start, after : , - , [ or ,), and the sequence item's first key is passed into the mapping so the duplicate check fires on its own line. See the tests "quotes and comments in plain values" and "a duplicate key in a sequence-item mapping is reported on its own line" in plugins/user-experience/tests/yaml-subset.test.mjs.

Unverified against the Python: confirm each with a failing test first.

Acceptance criteria

  • A failing test reproduces each bug against yaml_subset.py, then passes after the fix.
  • Existing yaml_subset.py tests still pass.
Lingua principale
Shell
Stelle
22
Fork
2
Merge medio
6h 42m
PR unite (30g)
902

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 melodic-software/claude-code-plugins

Tutte le issue di melodic-software/claude-code-plugins

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.