Skip to content

Split Review Body Lines Where GitHub Does in pr_review.py #3259

Closed

Description

@ptr727

The shape

scripts/pr_review.py reads a review body line by line through str.splitlines() at most of its line readers, coverage_statements, the headline reader, and unrecognized_in among them. splitlines breaks on a vertical tab, a form feed, \x1c through \x1e, \x85, 
, and 
 as well as on \n and \r. GitHub ends a line only at \n, \r\n, or \r, so a body carrying any of the others is split where GitHub renders one line.

Constructed case:

Prose about the change.\v## Overview

GitHub renders this as one paragraph. unrecognized_in splits it and reads ## Overview as a heading. The same split turns #\vOverview, which GitHub renders as text, into a bare # line that the heading reader now reads as an empty heading.

QUOTED_CHAR already spells out the splitlines set so that mask_quotations stays line-aligned with it, which shows the split is known there. What is missing is the readers splitting where GitHub does.

Expected

The line readers split on GitHub's own line endings, with the constructed case pinned by a test, and QUOTED_CHAR's alignment reasoning reconciled with the new split. No reviewer body has been seen carrying one of these characters, so this ranks low.

Found while consolidating the block-shape primitives for #3241.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions