2018-05-01 12:18:03 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -u
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
exit_code=0
|
|
|
|
image=w0rp/ale
|
|
|
|
docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$image")
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
echo '========================================'
|
|
|
|
echo 'Running custom linting rules'
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Custom warnings/errors follow:'
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
set -o pipefail
|
|
|
|
docker run -a stdout "${docker_flags[@]}" test/script/custom-linting-rules . || exit_code=$?
|
|
|
|
set +o pipefail
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
echo '========================================'
|
|
|
|
echo 'Checking for duplicate tags'
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Duplicate tags follow:'
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
grep --exclude=tags -roh '\*.*\*$' doc | sort | uniq -d || exit_code=$?
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
echo '========================================'
|
|
|
|
echo 'Checking for invalid tag references'
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Invalid tag references tags follow:'
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
tag_regex='[gb]\?:\?\(ale\|ALE\)[a-zA-Z_\-]\+'
|
2017-02-21 11:50:59 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
# Grep for tags and references, and complain if we find a reference without
|
|
|
|
# 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
|
2017-02-21 11:50:59 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
echo '========================================'
|
|
|
|
echo 'diff README.md and doc/ale.txt tables'
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Differences follow:'
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
test/script/check-supported-tools-tables || exit_code=$?
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
echo '========================================'
|
|
|
|
echo 'Look for badly aligned doc tags'
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Badly aligned tags follow:'
|
|
|
|
echo
|
2017-01-22 14:54:57 +00:00
|
|
|
|
2017-12-01 18:06:09 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
echo '========================================'
|
|
|
|
echo 'Look for table of contents issues'
|
|
|
|
echo '========================================'
|
|
|
|
echo
|
|
|
|
|
|
|
|
test/script/check-toc || exit_code=$?
|
|
|
|
|
|
|
|
exit $exit_code
|