summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2023-02-07 18:41:13 +0000
committerw0rp <devw0rp@gmail.com>2023-02-07 18:41:13 +0000
commitda5fa17df1182c3a4a30cc537b21df981f9bf93c (patch)
tree8a12c6b799223ad3f36b8f82b3fe2ac8c9ee485d /test
parente1ae009bac98d4c2a80ed8f70f68b75dab3bc478 (diff)
downloadale-da5fa17df1182c3a4a30cc537b21df981f9bf93c.zip
Fix broken tag references and the broken script to check them
Diffstat (limited to 'test')
-rwxr-xr-xtest/script/check-tag-references12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/script/check-tag-references b/test/script/check-tag-references
index 45e741fb..5f17618e 100755
--- a/test/script/check-tag-references
+++ b/test/script/check-tag-references
@@ -7,16 +7,24 @@ tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+'
tags="$(mktemp -t tags.XXXXXXXX)"
refs="$(mktemp -t refs.XXXXXXXX)"
+result="$(mktemp -t refs.XXXXXXXX)"
# Grep for tags and references, and complain if we find a reference without
# a tag for the reference. Only our tags will be included.
grep --exclude=tags -roh "\\*$tag_regex\\*" doc | sed 's/*//g' | sort -u > "$tags"
grep --exclude=tags -roh "|$tag_regex|" doc | sed 's/|//g' | sort -u > "$refs"
+# Collect tags in a file we can display to the user if there are differences.
+comm -23 "$refs" "$tags" > "$result"
+
exit_code=0
-if ! [[ $(comm -23 $refs $tags | wc -l) -eq 0 ]]; then
- exit_code=1
+# If there are differences, show them and error out.
+if ! [[ $(wc -l < "$result") -eq 0 ]]; then
+ cat "$result"
+ exit_code=1
fi
rm "$tags"
rm "$refs"
+rm "$result"
+exit $exit_code