Repository navigation
Stop the Prose Gate Reading a Bash Parameter Expansion as a Comment - #1830
Conversation
`extracted_comments` in the prose gate read the `#` inside a bash
parameter expansion such as `${#items[@]}` as a comment opener, so a
`run:` line counting an array was judged as prose, and an `echo`
string holding one failed `comment-wrap`.
A `#` right after `$` or `${` is now skipped as a line comment marker,
read off the raw line so an escaped `$` still counts. A real leading or
trailing comment on the same line is still extracted. The wider parser
carry work for string and heredoc content stays with #1664.
A regression test covers both spellings from the issue, `$#`, the
gate's own verdict on the `echo` line, and the still-extracted leading
and trailing comments. It fails with the fix reverted.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, matches the stated bug, and includes a regression test covering the reported cases and expected remaining behavior.
Review effort: Lite
Findings: None
What changed in this PR
This pull request updates the prose gate’s comment extractor to avoid misclassifying Bash parameter expansions (for example ${#items[@]} and $#) as # line comments, which previously caused false prose-rule failures on shell code embedded in workflow run: blocks.
Changes:
- Add
line_marker()to locate#line comment markers while skipping the#used in Bash parameter counting expansions. - Wire
extracted_comments()to useline_marker()for line-comment detection. - Add a regression test covering
${#items[@]},$#, and validation that real trailing/leading#comments are still extracted.
| File | Description |
|---|---|
.github/actions/prose-gate/prose_lint.py |
Teach comment extraction to ignore # immediately following $ / ${ so Bash parameter expansions are not treated as comments. |
scripts/tests/test_prose_lint.py |
Add regression coverage ensuring the extractor and rule pipeline no longer flags Bash array-count expansions as prose comments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… Fixes to Main (#1839) Promotes `develop` to `main`. ## Carried - #1830: stops the prose gate reading a `#` after `$` or `${` as a comment marker, per #1646. - #1832: corrects the comment on the `pr_review.py` quota-refusal remedy, per #1647. - #1834: accepts an absent, empty, or wildcard SessionEnd matcher as covering every exit reason, per #1638. - #1838: routes every question and every offer of more work through the interface's prompt mechanism, blocking or not. - #1841: describes a SessionEnd matcher by its shape in the installer report, following #1834. Closes #1646 Closes #1647 Closes #1638 🤖 Generated with [Claude Code](https://claude.com/claude-code)
extracted_commentsin the prose gate read the#inside a bash parameter expansion such as${#items[@]}as a comment opener, so arun:line counting an array was judged as prose, and anechostring holding one failedcomment-wrap.A
#right after$or${is now skipped as a line comment marker, read off the raw line so an escaped$still counts. A real leading or trailing comment on the same line is still extracted. The wider parser carry work for string and heredoc content stays with #1664.A regression test covers both spellings from the issue,
$#, the gate's own verdict on theecholine, and the still-extracted leading and trailing comments. It fails with the fix reverted.Closes on promotion: #1646
🤖 Generated with Claude Code