Skip to content

Skip the Run-Block Heredoc Split for a Non-Shell Step #3430

Closed

Description

@ptr727

Problem

The prose gate splits heredoc bodies out of every YAML run: block, because the run key always maps to the bash lexer whatever shell: says. In a shell: python block, a left shift by a name (1 << n) reads as a heredoc opener labelled n that never closes, so the rest of the script is lexed apart from its start. When a multi-line string opens on that same line, the string's quotes pair up wrongly in the cut-off part.

Reproduction (constructed)

- shell: python
  run: |
    m = 1 << n; s = """
    # not a comment
    """
    # real

Before the heredoc split the gate reports only real. With it, the gate reports not a comment and loses real. Without a multi-line string on the opener line, the false heredoc changes nothing.

What fixing it needs

Skip the heredoc split where the step's shell: names a non-shell language, or read only bash, sh, and an unset shell:. Rare: it needs a Python or similar block, a shift by a name, and a multi-line string on that line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions