From: Timo Heister Date: Thu, 8 Aug 2019 15:32:14 +0000 (-0600) Subject: indent: check for bad usernames and emails X-Git-Tag: v9.2.0-rc1~1281^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0a4de5a575331ece006fb8b55b85a9ac9cf082c;p=dealii.git indent: check for bad usernames and emails For compiling the list of contributors for each release, we rely on useful names and email addresses. We also regularly generate statistics about number of contributors, which requires identifying unique authors. This PR does the following: 1. Enforce in `indent` that users have a sensible name set that consists of at least two words (git config --global user.name) 2. Enforce in `indent` that users have sensible email addresses set by blocking some common invalid ones. 3. Add a .mailmap file that corrects a collection of invalid names/addresses already part of the history. This is a standard git file, which will replace output of `git log` and similar commands. Step 3 is necessary to make ./indent pass on master. --- diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..0d7150e248 --- /dev/null +++ b/.mailmap @@ -0,0 +1,60 @@ +# This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u +# gives no duplicates. + +# Format: +# Proper Name +# Proper Name +# +# You can have several lines for the same person if more than one incorrect +# email address is in use. +# +# Also see https://git-scm.com/docs/git-check-mailmap + + +# adam4130 +Adam Lee + +# tcclevenger +Thomas C. Clevenger + +# Roland +Roland Richter + +# saratro +Sara Tro + +# rfildes +Rebecca Fildes + +# notxor +Daniel Jodlbauer + +# marcfehling +Marc Fehling + +# rebeccampereira +Rebecca Pereira + +# peterrum +Peter Munch + +# ManaswineeB +Manaswinee Bezbaruah + +# blaisb +Bruno Blais + +# grahambenharper +Graham Harper + +# kirana-bergstrom +Kirana Bergstrom + +# luz.paz +unknown luzpaz + +# zhuoranwang@ZhuorandeMacBook-Pro.local +Zhuoran Wang + +# Wolfgang Bangerth +Wolfgang Bangerth diff --git a/contrib/utilities/indent_common.sh b/contrib/utilities/indent_common.sh index 40ac57c746..086dad381e 100644 --- a/contrib/utilities/indent_common.sh +++ b/contrib/utilities/indent_common.sh @@ -66,6 +66,43 @@ checks() { echo "*** to install a compatible binary into './contrib/utilities/programs'." exit 1 fi + + + # check formatting of usernames and email addresses, examples that will be detected: + # not-using-a-name + # John Doe + # Jane Doe + # + # For commits already in the history, please see .mailmap in the root directory. + # + # Note that we currently allow email addresses of the form + # Luca Heltai + # as these are generated when using the website to commit. + # + # Finally, to stay sane, just go back until the beginning of 2019 for now. + # + # first user names: + git log --since "2019-01-01" --format="%aN" | sort -u | while read name ; do + words=($name) + if [ "${#words[@]}" -lt "2" ]; then + echo "invalid author '$name' without firstname and lastname" + exit 2 + fi + done + + # now emails: + git log --since "2019-01-01" --format="%aE" | sort -u | while read email ; do + words=($name) + if ! echo "$email" | grep -q "\."; then + echo "invalid email '$email'" + exit 3 + fi + if ! echo "$email" | grep -q -v -e "\.local$"; then + echo "invalid email '$email'" + exit 3 + fi + done + } #