Hi Ard, I did a search for invalid tags in commit messages. Here is what I suggest as a change to PatchCheck.py to catch the cases I observe that includes the fix the to logic you suggested to find email addresses from edk2 groups/io mailing lists.
============================= diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 900226f18fe5..1c432f9d5688 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -54,36 +54,55 @@ class EmailAddressCheck: print(prefix, line) count += 1 - email_re1 = re.compile(r'(?:\s*)(.*?)(\s*)<(.+)>\s*$', + email_re1 = re.compile(r'(?:\s*)(.*?)(\s*)<(.+)>\s*(.*?)$', re.MULTILINE|re.IGNORECASE) def check_email_address(self, email): email = email.strip() mo = self.email_re1.match(email) + + # Check for too few fields if mo is None: - self.error("Email format is invalid: " + email.strip()) + self.error("Email format is invalid: " + email) + return + if len (mo.groups()) < 3: + self.error("Email format is missing fields: " + email) return + # Check the name name = mo.group(1).strip() - if name == '': - self.error("Name is not provided with email address: " + - email) - else: - quoted = len(name) > 2 and name[0] == '"' and name[-1] == '"' - if name.find(',') >= 0 and not quoted: - self.error('Add quotes (") around name with a comma: ' + - name) + if ',' in name: + self.error('Change order of name and remove comma: ' + name) + if '"' in name: + self.error('Remove double quotes around name: ' + name) + if ' via ' in name: + self.error('Remove via from another source from name: ' + name) - if mo.group(2) == '': - self.error("There should be a space between the name and " + + # Check whitespace between name and email address + if len(mo.group(2)) != mo.group(2).count(' '): + self.error("There should only be spaces between the name and " + "email address: " + email) - if mo.group(3).find(' ') >= 0: - self.error("The email address cannot contain a space: " + + # Check the email address + if mo.group(3).count(' ') >= 1: + self.error("The email address must not contain any spaces: " + mo.group(3)) - if ' via Groups.Io' in name and mo.group(3).endswith('@groups.io'): - self.error("Email rewritten by lists DMARC / DKIM / SPF: " + + if mo.group(3).count('=') >= 1: + self.error("The email address must not contain any '=': " + + mo.group(3)) + + if mo.group(3).count('@') != 1: + self.error("The email address must contain a single @: " + + mo.group(3)) + + if '@edk2.groups.io' in mo.group(3): + self.error("The email address cannot be from @edk2.groups.io: " + + mo.group(3)) + + # Check for too many fields + if len(mo.groups()) > 3 and len(mo.group(4)) > 0: + self.error("Email format has too many fields: " + email) ============================= With this change I looked at the last 500 commits to edk2 repo and it finds the following issues: * Remove double quotes around name: "devel@edk2.groups.io" * The email address cannot be from @edk2.groups.io: devel@edk2.groups.io * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" * Change order of name and remove comma: "Zhang, Hongbin1" * Remove double quotes around name: "Zhang, Hongbin1" * Remove double quotes around name: "devel@edk2.groups.io" * The email address cannot be from @edk2.groups.io: devel@edk2.groups.io * Change order of name and remove comma: "Aishwarya, KurugoduMelmatamX" * Remove double quotes around name: "Aishwarya, KurugoduMelmatamX" * Email format is invalid: jiewen....@intel.com * Email format has too many fields: Jiewen Yao <jiewen....@intel.com> [jyao1] * Email format has too many fields: Yi Li <yi1...@intel.com> [liyi77] * Email format has too many fields: Xiaoyu Lu <xiaoyu1...@intel.com> [xiaoyuxlu] * Email format has too many fields: Guomin Jiang <guomin.ji...@intel.com> [guominjia] * Change order of name and remove comma: "Ni, Ray" * Remove double quotes around name: "Ni, Ray" * Remove double quotes around name: "Mikolaj Lisik via groups.io" * Remove via from another source from name: "Mikolaj Lisik via groups.io" * The email address must not contain any '=': lisik=google....@groups.io * Change order of name and remove comma: "Kinney, Michael D" * Remove double quotes around name: "Kinney, Michael D" * Change order of name and remove comma: "Liu, Zhiguang" * Remove double quotes around name: "Liu, Zhiguang" * Change order of name and remove comma: "Liu, Zhiguang" * Remove double quotes around name: "Liu, Zhiguang" * Change order of name and remove comma: "Liu, Zhiguang" * Remove double quotes around name: "Liu, Zhiguang" * Change order of name and remove comma: "Liu, Zhiguang" * Remove double quotes around name: "Liu, Zhiguang" * Change order of name and remove comma: "Tan, Ming" * Remove double quotes around name: "Tan, Ming" * The email address must not contain any spaces: igork @ami.com * The email address must not contain any spaces: igork @ami.com * The email address must not contain any spaces: igork @ami.com * The email address must not contain any spaces: igork @ami.com * The email address must not contain any spaces: igork @ami.com * Change order of name and remove comma: "Roth, Michael via groups.io" * Remove double quotes around name: "Roth, Michael via groups.io" * Remove via from another source from name: "Roth, Michael via groups.io" * The email address must not contain any '=': Michael.Roth=amd....@groups.io * Change order of name and remove comma: "Roth, Michael via groups.io" * Remove double quotes around name: "Roth, Michael via groups.io" * Remove via from another source from name: "Roth, Michael via groups.io" * The email address must not contain any '=': Michael.Roth=amd....@groups.io * Change order of name and remove comma: "Roth, Michael via groups.io" * Remove double quotes around name: "Roth, Michael via groups.io" * Remove via from another source from name: "Roth, Michael via groups.io" * The email address must not contain any '=': Michael.Roth=amd....@groups.io * Change order of name and remove comma: "Duggapu, Chinni B" * Remove double quotes around name: "Duggapu, Chinni B" * Remove double quotes around name: "devel@edk2.groups.io" * The email address cannot be from @edk2.groups.io: devel@edk2.groups.io * Change order of name and remove comma: "Lin, MillerX" * Remove double quotes around name: "Lin, MillerX" * Change order of name and remove comma: "Lendacky, Thomas via groups.io" * Remove double quotes around name: "Lendacky, Thomas via groups.io" * Remove via from another source from name: "Lendacky, Thomas via groups.io" * The email address must not contain any '=': thomas.lendacky=amd....@groups.io * Change order of name and remove comma: "Lendacky, Thomas via groups.io" * Remove double quotes around name: "Lendacky, Thomas via groups.io" * Remove via from another source from name: "Lendacky, Thomas via groups.io" * The email address must not contain any '=': thomas.lendacky=amd....@groups.io * Change order of name and remove comma: "Albecki, Mateusz" * Remove double quotes around name: "Albecki, Mateusz" * Change order of name and remove comma: "Xie, Yuanhao" * Remove double quotes around name: "Xie, Yuanhao" Let me know if you think this is too strict. Mike > -----Original Message----- > From: Ard Biesheuvel <a...@kernel.org> > Sent: Thursday, July 20, 2023 10:19 AM > To: devel@edk2.groups.io; Kinney, Michael D <michael.d.kin...@intel.com> > Cc: Leif Lindholm <quic_llind...@quicinc.com>; Demeter, Miki > <miki.deme...@intel.com>; Kasbekar, Saloni <saloni.kasbe...@intel.com>; > Nickle Wang <nick...@nvidia.com>; Clark-williams, Zachary <zachary.clark- > willi...@intel.com>; Abner Chang <abner.ch...@amd.com>; Igor Kulchytskyy > <ig...@ami.com>; Nick Ramirez <nrami...@nvidia.com> > Subject: Re: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver > binding start issue. > > On Thu, 20 Jul 2023 at 19:10, Michael D Kinney > <michael.d.kin...@intel.com> wrote: > > > > Hi Ard, > > > > This is my mistake. I usually check the Author field when > > adding Rb/Ab tags because I have seen lots of cases where > > the Author field needs updating as well. I forgot to do this > > step in this one. > > > > I agree a CI check against the Author field being a valid > > email address and not one of the mailing addresses would be > > valuable. Perhaps in PatchCheck.py? > > > > Yeah, and actually, a test seems to exist already but it didn't catch > this particular case: > > if ' via Groups.Io' in name and > mo.group(3).endswith('@groups.io'): > self.error("Email rewritten by lists DMARC / DKIM / SPF: " + > email) > > I suppose replacing the 'and' with 'or' would be sufficient here? I > don't think @groups.io is ever a valid author email domain. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107191): https://edk2.groups.io/g/devel/message/107191 Mute This Topic: https://groups.io/mt/99821789/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-