diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a0fa1348bb6e6..3c774e3e5f7c1 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -1744,28 +1744,33 @@ def run(self): 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(rf"signed-off-by:\s({re.escape(auth_name)}) <({re.escape(auth_email)})>", - body, - re.IGNORECASE) + continue 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 " "@users.noreply.github.com") - if not match_signoff: + # Returns an array of everything to the right of ':' on each signoff line + signoff_lines = re.findall(r"signed-off-by:\s(.*)", body, re.IGNORECASE) + if len(signoff_lines) == 0: failures.append(f'{shaidx}: Missing signed-off-by line') - elif not detailed_match: - signoff = match_signoff.group(0) - failures.append(f"{shaidx}: Signed-off-by line ({signoff}) " - "does not follow the syntax: First " - "Last .") - elif (auth_name, auth_email) != detailed_match.groups(): - failures.append(f"{shaidx}: author email ({auth_email}) needs " - "to match one of the signed-off-by entries.") + else: + # Validate all signoff lines' syntax while also searching for commit author + found_author_signoff = False + for signoff in signoff_lines: + match = re.search(r"(.+) <(.+)>", signoff) + + if not match: + failures.append(f"{shaidx}: Signed-off-by line ({signoff}) " + "does not follow the syntax: First " + "Last .") + elif (auth_name, auth_email) == match.groups(): + found_author_signoff = True + + if not found_author_signoff: + failures.append(f"{shaidx}: author name ({auth_name}) and email ({auth_email}) " + "needs to match one of the signed-off-by entries.") if failures: self.failure('\n'.join(failures))