From a8e8066d045b81c008151dfa0273f635177e2d60 Mon Sep 17 00:00:00 2001 From: Jason Yundt Date: Sat, 18 Feb 2023 07:06:52 -0500 Subject: [PATCH] Simplify author regex in update-authors.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this change, update-authors.py would use a more complicated regex pattern. That pattern would sometimes fail to match anything and result in match() returning None followed by an AttributeError. The old regex pattern already assumed that there would be a "\t" before the information that we’re looking for. This new pattern starts by looking for the "\t" (rather than worrying about what comes before the "\t"). The new pattern also simplifies the rules for matching an author’s name and email. If we really want to enforce rules like “the author’s name must only use word characters and spaces” or “the author’s email must not contain ‘>’”, then we should add a CI check or something. Fixes #3109. --- AUTHORS | 33 ++++++++++++++++++++++++++++++++- update-authors.py | 4 ++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 91983287d..2c28e5935 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,24 +5,55 @@ Adrian Likins Alexander Saprykin Andrew Crosby Brian Coca +Brian McLaughlin +Calvin Spealman Chris Church Chris Houseknecht +Chris Meyers Christopher Chase +David Davis +David Moreau Simard David Newswanger David Zager -Dostonbek +Dostonbek Toirov <31990136+Dostonbek1@users.noreply.github.com> +Egor Margineanu +Evgeni Golov +Guillaume Delacour Ivan Ivan Remizov +Jake Jackson James Cammarata +Jason Yundt +Jeff Geerling Jiri Tyr Joe Fiorini John Corrales John R Barker +John R Barker Jorge Heleno +Jürgen Etzlstorfer Karl Goetz +Kevin Breit Khrystyna Bugaienko +Kyle <3204236+DevKyleS@users.noreply.github.com> +Leon M. George +Martin Hradil Martin Krizek +Nicolas Quiniou-Briand +Paul Belanger +Paul Belanger Paul dG +Ryuichi Watanabe +Samy Coenen +Sandra McCann +Strix <660956+MrStrix@users.noreply.github.com> +Sviatoslav Sydorenko +Thad Guidry +Till! Timothy Appnel +Yanis Guenane cclauss +ironfroggy +ironfroggy jawyoonis +jctanner diff --git a/update-authors.py b/update-authors.py index 5c75a6008..954cc2efb 100755 --- a/update-authors.py +++ b/update-authors.py @@ -3,11 +3,11 @@ import re import subprocess -author_re = re.compile(r'^\s*\d+\t([\w ]+ <[^>]+>)$') +author_re = re.compile(r'(?<=\t).*') git_log = subprocess.check_output(['git', 'shortlog', '--summary', '--email']) log_entries = git_log.decode('utf-8').strip().split('\n') -authors = [author_re.match(entry).group(1) for entry in log_entries] +authors = [author_re.search(entry).group(0) for entry in log_entries] print("Galaxy has been contribued to by the following authors:\n"