diff options
author | Philippe Mathieu-Daude <philmd@redhat.com> | 2020-01-09 18:55:45 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-01-10 04:06:42 +0000 |
commit | c0328cf3803b215a62f05633024f9dd6e5b805a0 (patch) | |
tree | 95e3ae4b55f8b17fe63ddc52885640dfa9d8654c /BaseTools/Scripts | |
parent | 8120390aabe6bc6a6ecb5c94a2865a9b55095f9b (diff) | |
download | edk2-c0328cf3803b215a62f05633024f9dd6e5b805a0.tar.gz |
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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
Diffstat (limited to 'BaseTools/Scripts')
-rwxr-xr-x | BaseTools/Scripts/PatchCheck.py | 7 |
1 files changed, 6 insertions, 1 deletions
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.
|