From d5882c886e37f3c8d94272885364e6198b3b4360 Mon Sep 17 00:00:00 2001 From: Rob Mohr Date: Tue, 27 Dec 2022 18:05:23 +0000 Subject: [PATCH] pw_presubmit: Allow long lines in blockquotes Allow long lines in commit messages if they're in blockquotes. Change-Id: Ic03ddf4399527afd455d2185b889b45b07a87575 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/125490 Reviewed-by: Wyatt Hepler Pigweed-Auto-Submit: Rob Mohr Commit-Queue: Auto-Submit --- .../py/pw_presubmit/pigweed_presubmit.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py index 62bb41f2fe..75623bbfa7 100755 --- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py +++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py @@ -866,11 +866,19 @@ def commit_message_format(_: PresubmitContext): _LOG.warning('Ignoring Copybara import') return - # Check that the lines are 72 characters or less, but skip any lines that - # might possibly have a URL, path, or metadata in them. Also skip any lines - # with non-ASCII characters. + # Check that the lines are 72 characters or less. for i, line in enumerate(lines[2:], 3): - if any(c in line for c in ':/>') or not line.isascii(): + # Skip any lines that might possibly have a URL, path, or metadata in + # them. + if any(c in line for c in ':/>'): + continue + + # Skip any lines with non-ASCII characters. + if not line.isascii(): + continue + + # Skip any blockquoted lines. + if line.startswith(' '): continue if len(line) > 72: