summaryrefslogtreecommitdiff
path: root/test/script/check-tag-references
diff options
context:
space:
mode:
authorKevin Clark <kevin.clark@gmail.com>2020-11-28 08:25:27 -0800
committerKevin Clark <kevin.clark@gmail.com>2020-11-28 08:26:13 -0800
commitd52dce2e6f9ed23103e8d32d41de46c6d9b6717c (patch)
tree52024838238bc0ea0493e382c63275cfdf659c35 /test/script/check-tag-references
parente300a48e13d5863e8281c5843d1128224f73696d (diff)
downloadale-d52dce2e6f9ed23103e8d32d41de46c6d9b6717c.zip
Use docker image for custom-check scripts
NOTE: The custom-linting-rules test fails due to the following (legit) warnings: ale_linters/clojure/clj_kondo.vim:29 Use snake_case names for linters ale_linters/elixir/elixir_ls.vim:15 Use snake_case names for linters ale_linters/go/golangci_lint.vim:54 Use snake_case names for linters ale_linters/swift/swiftformat.vim:56 Use snake_case names for linters The message wasn't getting printed because docker was explicitly only being asked to connect stdout (ignoring stderr). Unclear yet why the error code wasn't getting bubbled up.
Diffstat (limited to 'test/script/check-tag-references')
-rwxr-xr-xtest/script/check-tag-references22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/script/check-tag-references b/test/script/check-tag-references
new file mode 100755
index 00000000..45e741fb
--- /dev/null
+++ b/test/script/check-tag-references
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+set -e
+
+exit_code=0
+tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+'
+
+tags="$(mktemp -t tags.XXXXXXXX)"
+refs="$(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"
+
+exit_code=0
+
+if ! [[ $(comm -23 $refs $tags | wc -l) -eq 0 ]]; then
+ exit_code=1
+fi
+
+rm "$tags"
+rm "$refs"