diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-09-05 01:31:14 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2014-09-05 01:31:14 -0400 |
commit | 4b70501e432eb5fd9ed04a4afbadafabd982e9fc (patch) | |
tree | b09fe80d9ec0ec3eb82f46dbfce960dc66aaf3f4 /bin/check-format | |
parent | 1ab58422fb47e22e178716efa3fbce5beabbc174 (diff) |
restructure to have most data in YAML
Diffstat (limited to 'bin/check-format')
-rwxr-xr-x | bin/check-format | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/check-format b/bin/check-format new file mode 100755 index 0000000..06b880a --- /dev/null +++ b/bin/check-format @@ -0,0 +1,38 @@ +#!/bin/bash +cfg_hackers="hackers.yml" + +###################################################################### + +. libremessages + +file=$cfg_hackers +ret=0 + +norm=$(mktemp --tmpdir) +trap "rm -f -- $(printf '%q' "$norm")" EXIT +"$(dirname "$0")/normalize-stdio" < "$file" > "$norm" || exit 1 + +usernames=($(<"$norm" sed -n 's/^[ -] username: //p' | sort)) + +dups=($(printf '%s\n' "${usernames[@]}" | uniq -d)) +if (( ${#dups[@]} )); then + error 'Duplicate usernames:' + plain '%s' "${dups[@]}" + ret=1 +fi + +illegal=($(printf '%s\n' "${usernames[@]}" | grep -v '^[a-z][a-z0-9]*$')) +if (( ${#illegal[@]} )); then + error 'Illegal usernames:' + plain '%s' "${illegal[@]}" + ret=1 +fi + +if "$(dirname "$0")/list-pgp-keyids" | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then + error 'Bad pgp keys ^^^' + ret=1 +fi + +colordiff -u "$file" "$norm" || ret=$? + +exit $ret |