Skip to content

scripts: compliance: Avoid exception when commit message body is empty #89888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions scripts/ci/check_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1456,17 +1456,24 @@ class Identity(ComplianceTest):

def run(self):
for shaidx in get_shas(COMMIT_RANGE):
auth_name, auth_email, body = git(
'show', '-s', '--format=%an%n%ae%n%b', shaidx
).split('\n', 2)
commit_info = git('show', '-s', '--format=%an%n%ae%n%b', shaidx).split('\n', 2)

failures = []

if len(commit_info) == 2:
failures.append(f'{shaidx}: Empty commit message body')
auth_name, auth_email = commit_info
body = ''
elif len(commit_info) == 3:
auth_name, auth_email, body = commit_info
else:
self.failure(f'Unable to parse commit message for {shaidx}')

match_signoff = re.search(r"signed-off-by:\s(.*)", body,
re.IGNORECASE)
detailed_match = re.search(r"signed-off-by:\s(.*) <(.*)>", body,
re.IGNORECASE)

failures = []

if auth_email.endswith("@users.noreply.github.com"):
failures.append(f"{shaidx}: author email ({auth_email}) must "
"be a real email and cannot end in "
Expand Down
Loading