From c0328cf3803b215a62f05633024f9dd6e5b805a0 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daude Date: Thu, 9 Jan 2020 18:55:45 +0800 Subject: [PATCH] BaseTools/PatchCheck.py: Check the patch author email address To avoid patches committed with incorrect email address, use the EmailAddressCheck class on the author email too. Example: $ python BaseTools/Scripts/PatchCheck.py 1a04951309f Checking git commit: 1a04951309f The 'Author' email address is not valid: * The email address cannot contain a space: /o=Intel/ou=External \ (FYDIBOHF25SPDLT)/cn=Recipients/cn=fe425ca7e5f4401abed22b904fe5d964 Cc: Bob Feng Cc: Liming Gao Reviewed-by: Bob Feng Signed-off-by: Philippe Mathieu-Daude --- BaseTools/Scripts/PatchCheck.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 58d0112544..fe8e6a64f2 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -451,6 +451,9 @@ class CheckOnePatch: self.patch = patch self.find_patch_pieces() + email_check = EmailAddressCheck(self.author_email, 'Author') + email_ok = email_check.ok + msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg) msg_ok = msg_check.ok @@ -459,7 +462,7 @@ class CheckOnePatch: diff_check = GitDiffCheck(self.diff) diff_ok = diff_check.ok - self.ok = msg_ok and diff_ok + self.ok = email_ok and msg_ok and diff_ok if Verbose.level == Verbose.ONELINE: if self.ok: @@ -537,6 +540,8 @@ class CheckOnePatch: self.commit_subject = self.commit_subject.replace('\n', '') self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1) + self.author_email = pmail['from'] + class CheckGitCommits: """Reads patches from git based on the specified git revision range.