Skip to content

Commit d7ad625

Browse files
authored
MINOR Fix PR Linter "Reviewers" handling (apache#19415)
This patch fixes the textwrap for Reviewers to support the RFC 822 folding rules. From the RFC, headers or trailers can break across multiple lines if there is a leading whitespace on subsequent lines. This allows "git interpret-trailers" to correctly parse long "Reviewers:" lines. Reviewers: Lianet Magrans <[email protected]>
1 parent 6e446f0 commit d7ad625

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.github/scripts/pr-format.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ def check(positive_assertion, ok_msg, err_msg):
162162
new_lines.append(textwrap.fill(line, width=72, break_long_words=False, break_on_hyphens=False, replace_whitespace=False))
163163
rewrapped_p = "\n".join(new_lines)
164164
else:
165-
rewrapped_p = textwrap.fill("".join(p), width=72, break_long_words=False, break_on_hyphens=False, replace_whitespace=True)
165+
indent = ""
166+
if len(p) > 0 and p[0].startswith("Reviewers:"):
167+
indent = " "
168+
rewrapped_p = textwrap.fill("".join(p), subsequent_indent=indent, width=72, break_long_words=False, break_on_hyphens=False, replace_whitespace=True)
166169
new_paragraphs.append(rewrapped_p + "\n")
167170
body = "\n".join(new_paragraphs)
168171

0 commit comments

Comments
 (0)