code-metrics yaml_subset.py: quote mid-value swallows comments; duplicate key in a sequence item reports the wrong line
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
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
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:
- A quote mid-value swallows a trailing comment.
stripCommenttreats any'or"as the start of a quoted string, even inside a plain value, sotitle: it's fine # commentparses as"it's fine # comment"instead of"it's fine". - 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.pytests still pass.
- Dominant language
- Shell
- Stars
- 22
- Forks
- 2
- Avg merge
- 5h 18m
- Merged PRs (30d)
- 869
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from melodic-software/claude-code-plugins
-
good first issue needs-triage priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melodic-software/claude-code-plugins#6631 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
melodic-software/claude-code-plugins#6547 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
melodic-software/claude-code-plugins#6535 ·
Maintainers usually reply within 1 day
-
test_comment_census.py: SccArgv flag-shaped-filename test errors on Windows (#!/bin/sh scc shim)Opengood first issue needs-triage priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melodic-software/claude-code-plugins#6532 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue needs-triage priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melodic-software/claude-code-plugins#6390 · 1 comment ·
Maintainers usually reply within 1 day
All issues in melodic-software/claude-code-plugins
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zerocracy/judges-action#2733 ·
Maintainers usually reply within 8 days
-
dependencies feature github_actions good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
wemake-services/wemake-django-template#3149 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
crazy-goat/rabbit-stream#830 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
luainkernel/lunatik#1853 ·
Maintainers usually reply within 1 day