Skip to content

Read a Second Heredoc on One Opener Line Without Letting Its Apostrophes Hide Later Comments #3428

Closed

Description

@ptr727

Problem

The prose gate reads only the first heredoc on an opener line as a heredoc. A second one (<<A 3<<B) is read as code, so an apostrophe in its body opens a bash string that Pygments extends to the next ', hiding every comment between the two from comment-wrap, comment-case, comment-added and issue-ref.

Reproduction (constructed)

- run: |
    diff - /dev/fd/3 <<A 3<<B
    one
    A
    The build didn't publish.
    B
    # retry the upload.
    jq -r '.x' o.json

uv run --no-project --script .github/actions/prose-gate/prose_lint.py --check comment-case x.yml reports nothing, where the comment opens lowercase. The same shape in a .sh file is read by the patched HEREDOC rule, which also handles one heredoc per opener line.

What fixing it needs

The HEREDOC rule in prose_lint.py ends a body on the first opener's terminator and has no way to queue a second. Reading a second body means the lexer carries the pending delimiters across the line. This is a pre-existing gap found while fixing #3413 and is rare in real run blocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions