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.
This commit is contained in:
Kevin Clark
2020-11-28 08:25:27 -08:00
parent e300a48e13
commit d52dce2e6f
4 changed files with 52 additions and 16 deletions

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
grep --exclude=tags -roh '\*.*\*$' doc | sort | uniq -d

11
test/script/check-tag-alignment Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
exit_code=0
# Documentation tags need to be aligned to the right margin, so look for
# tags which aren't at the right margin.
grep ' \*[^*]\+\*$' doc/ -r \
| awk '{ sep = index($0, ":"); if (length(substr($0, sep + 1 )) < 79) { print } }' \
| grep . && exit_code=1
exit $exit_code

View File

@@ -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"

View File

@@ -13,7 +13,7 @@ echo 'Custom warnings/errors follow:'
echo echo
set -o pipefail set -o pipefail
docker run -a stdout "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$? docker run "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$?
set +o pipefail set +o pipefail
echo echo
@@ -23,7 +23,10 @@ echo '========================================'
echo 'Duplicate tags follow:' echo 'Duplicate tags follow:'
echo echo
grep --exclude=tags -roh '\*.*\*$' doc | sort | uniq -d || exit_code=$? set -o pipefail
docker run "${docker_flags[@]}" test/script/check-duplicate-tags . || exit_code=$?
set +o pipefail
echo
echo '========================================' echo '========================================'
echo 'Checking for invalid tag references' echo 'Checking for invalid tag references'
@@ -31,14 +34,9 @@ echo '========================================'
echo 'Invalid tag references tags follow:' echo 'Invalid tag references tags follow:'
echo echo
tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+' set -o pipefail
docker run "${docker_flags[@]}" test/script/check-tag-references || exit_code=$?
# Grep for tags and references, and complain if we find a reference without set +o pipefail
# a tag for the reference. Only our tags will be included.
diff -u \
<(grep --exclude=tags -roh "\\*$tag_regex\\*" doc | sort -u | sed 's/*//g') \
<(grep --exclude=tags -roh "|$tag_regex|" doc | sort -u | sed 's/|//g') \
| grep '^+[^+]' && exit_code=1
echo '========================================' echo '========================================'
echo 'diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables' echo 'diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables'
@@ -56,18 +54,18 @@ echo '========================================'
echo 'Badly aligned tags follow:' echo 'Badly aligned tags follow:'
echo echo
# Documentation tags need to be aligned to the right margin, so look for set -o pipefail
# tags which aren't at the right margin. docker run "${docker_flags[@]}" test/script/check-tag-alignment || exit_code=$?
grep ' \*[^*]\+\*$' doc/ -r \ set +o pipefail
| awk '{ sep = index($0, ":"); if (length(substr($0, sep + 1 )) < 79) { print } }' \
| grep . && exit_code=1
echo '========================================' echo '========================================'
echo 'Look for table of contents issues' echo 'Look for table of contents issues'
echo '========================================' echo '========================================'
echo echo
test/script/check-toc || exit_code=$? set -o pipefail
docker run "${docker_flags[@]}" test/script/check-toc || exit_code=$?
set +o pipefail
echo '========================================' echo '========================================'
echo 'Check Python code' echo 'Check Python code'