Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#6,699 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
devtools

Research direction

The two bugs are in plugins/code-metrics/scripts/yaml_subset.py, in the comment-stripping logic (where a quote opens a string) and in the duplicate-key check for sequence items. The JavaScript port in plugins/user-experience/scripts/lib/yaml-subset.mjs, fixed in commit 1d5a3fca3f, shows the intended behaviour, and its tests are in plugins/user-experience/tests/yaml-subset.test.mjs. Write failing Python tests for title: it's fine # comment and for the - job: a duplicate-key input first. Done when both reproduce, both pass after the fix, and the existing yaml_subset.py tests still pass.

Written by the indexing model from the issue text.

Description

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.
Dominant language
Shell
Stars
22
Forks
2
Avg merge
5h 18m
Merged PRs (30d)
869

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from melodic-software/claude-code-plugins

All issues in melodic-software/claude-code-plugins

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.