summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2019-02-11 03:14:19 -0500
committerbill-auger <mr.j.spam.me@gmail.com>2019-02-11 03:27:34 -0500
commitcf5941cd950cea16c413704ba21f289742434d2e (patch)
treededda5e7aec366eab6dbf4d04033cc9075f0a865
parent20567813917763f2009d91c7392313b269dadd5d (diff)
bugfix/refactor chech.shpyqt5
-rwxr-xr-xcheck.sh36
1 files changed, 22 insertions, 14 deletions
diff --git a/check.sh b/check.sh
index 9e84cc7..bc198f7 100755
--- a/check.sh
+++ b/check.sh
@@ -9,28 +9,36 @@
readonly CSV_CHAR=':'
readonly SEP_CHAR='!'
+exit_status=0
-# Verify the blacklist entries are correctly formatted.
-bad_entries="$(egrep -v '^[^:]*:[^:]*:(sv|debian|parabola|fsf|fedora)?:[^:]*:.*$' *.txt)"
+# Verify the blacklist entries are correctly formatted.
-if [[ ! -z "$bad_entries" ]]; then
- printf "Incorrectly formatted entries:\n\n%s\n" "$bad_entries" >&2
- exit 1
+printf "checking for entries with syntax errors: ... " >&2
+invalid="$(egrep -v '^[^:]*:[^:]*:(sv|debian|parabola|fsf|fedora)?:[^:]*:.*$' *.txt)"
+if [[ -z "$invalid" ]]
+then printf "OK\n" >&2
+else printf "\n[Incorrectly formatted entries]:\n\n%s\n\n" "$invalid" >&2
+ exit_status=1
fi
-unsourced="$(egrep '^[^:]*:[^:]*::[^:]*:.*$' *.txt)"
-if [[ ! -z "$unsourced" ]]; then
- printf "[citation needed]:\n\n%s\n" "$unsourced" >&2
- exit 1
+printf "checking for entries without reference to detailed description: ... " >&2
+unsourced="$(egrep '^[^:]*:[^:]*::[^:]*:.*$' *.txt)"
+if [[ -z "$unsourced" ]]
+then printf "OK\n" >&2
+else printf "\n[citation needed]:\n\n%s\n\n" "$unsourced" >&2
+ exit_status=1
fi
-# TODO: this could be removed someday - see note in 'sort-entries' script
+# TODO: this check could be removed someday - see note in 'sort-entries' script
+printf "checking for entries that the 'sort-entries' script would mutate: ... " >&2
unsortable="$(grep ${SEP_CHAR} *.txt)"
-
-if [[ ! -z "$unsortable" ]]; then
- printf "[non-uniform sorting] entry contains '$s' char" ${SEP_CHAR} >&2
- exit 1
+if [[ -z "$unsortable" ]]
+then printf "OK\n" >&2
+else printf "\n[Entries contain '%s' char]:\n\n%s\n\n" "${SEP_CHAR}" "$unsortable" >&2
+ exit_status=1
fi
+
+exit $exit_status