test_commit_format: no longer check body length

There are quite a few, genuine useful cases where one wants to overflow
the recommended 75 (some use 72) character rule.

Breaking long lines or manually breaking long compiler or other
tool-generated outputs is just confusing and error-prone.

This does not mean that we should stop wrapping manually written text
at a sane length, but enforcing the rule with a script seems to yield
questionable results while creating quite a bit of friction.

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
This commit is contained in:
Erik Schilling
2023-07-07 07:09:35 +02:00
committed by Jonathan Woollett-Light
parent 9dfe5b267c
commit 7c1057e9bc

View File

@@ -28,9 +28,8 @@ def test_commit_format():
"""
Checks commit message format for the current PR's commits.
Checks if commit messages follow the 60/75 commit rule (a maximum
60 characters for the title and 75 characters for description
lines) and if commits are signed.
Checks if commit messages do not have exceedingly long titles (a maximum 60
characters for the title) and if commits are signed.
"""
# Newer versions of git check the ownership of directories.
# We need to add an exception for /workdir which is shared, so that
@@ -80,15 +79,8 @@ def test_commit_format():
for line in message_lines[2:]:
if line.startswith("Signed-off-by: "):
found_signed_off = True
# If we found `Signed-off-by` line, then it means
# the commit message ended and we don't want to check
# line lengths anymore for the current commit.
break
assert len(line) <= COMMIT_BODY_LINE_MAX_LEN, (
"For commit '{}', message line '{}' exceeds {} chars. "
"Please keep it shorter or split it in "
"multiple lines.".format(sha, line, COMMIT_BODY_LINE_MAX_LEN)
)
assert found_signed_off, (
"Commit '{}' is not signed. "
"Please run 'git commit -s --amend' "