1
0
Fork 0
mirror of synced 2024-06-29 20:11:09 -04:00
ultimate-vim/sources_non_forked/ale/test/script/check-tag-references
2022-05-19 21:16:38 +08:00

23 lines
563 B
Bash
Executable file

#!/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"