Presubmit: relax line length rules for quotes

... and : after Roll, Reland etc

Bug: angleproject:4683
Change-Id: Ibe1098402a2fd67b929a71fa74c5a1747a90fc3d
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4261310
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
This commit is contained in:
Shahbaz Youssefi
2023-02-16 11:41:46 -05:00
committed by Angle LUCI CQ
parent 8c2fcc7086
commit 27d412fbb7
2 changed files with 25 additions and 3 deletions

View File

@@ -68,7 +68,7 @@ def _CheckCommitMessageFormatting(input_api, output_api):
def _CheckTabInCommit(lines):
return all([line.find("\t") == -1 for line in lines])
allowlist_strings = ['Revert "', 'Roll ', 'Manual roll ', 'Reland ', 'Re-land ']
allowlist_strings = ['Revert', 'Roll', 'Manual roll', 'Reland', 'Re-land']
summary_linelength_warning_lower_limit = 65
summary_linelength_warning_upper_limit = 70
description_linelength_limit = 72
@@ -170,9 +170,9 @@ def _CheckCommitMessageFormatting(input_api, output_api):
# loop through description body
while len(commit_msg_lines) > 0:
line = commit_msg_lines.pop(0)
# lines starting with 4 spaces or lines without space(urls)
# lines starting with 4 spaces, quotes or lines without space(urls)
# are exempt from length check
if line.startswith(" ") or " " not in line:
if line.startswith(" ") or line.startswith("> ") or " " not in line:
continue
if len(line) > description_linelength_limit:
errors.append(

View File

@@ -212,6 +212,19 @@ dddd
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
a: d"""
errors = self.run_check_commit_message_formatting(commit_msg)
self.assertEqual(len(errors), 0)
def test_description_body_exceeds_line_count_limit_but_in_quote(self):
commit_msg = """a
cc
dddd
> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
a: d"""
errors = self.run_check_commit_message_formatting(commit_msg)
self.assertEqual(len(errors), 0)
@@ -251,6 +264,15 @@ Change-Id: I443c36aaa8956c20da1abddf7aea613659e2cd5b"""
bbbbbbbbbbbbbbbbbbbb
Change-Id: I443c36aaa8956c20da1abddf7aea613659e2cd5b"""
errors = self.run_check_commit_message_formatting(commit_msg)
self.assertEqual(len(errors), 0)
def test_allowlist_reland2(self):
commit_msg = """Reland: sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssadd
bbbbbbbbbbbbbbbbbbbb
Change-Id: I443c36aaa8956c20da1abddf7aea613659e2cd5b"""
errors = self.run_check_commit_message_formatting(commit_msg)
self.assertEqual(len(errors), 0)