test-documentation: Fix shellcheck warnings.

In tools/test-documentation line 6:
    echo -e "\e[${color_code}m${message}\e[0m" >&2
             ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
                                        ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".

In tools/test-documentation line 41:
scrapy crawl_with_status documentation_crawler $loglevel
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg 2018-08-03 00:14:50 +00:00 committed by Tim Abbott
parent bb51503907
commit e1d770d451
1 changed files with 5 additions and 3 deletions

View File

@ -3,9 +3,11 @@ set -e
color_message () { color_message () {
local color_code="$1" message="$2" local color_code="$1" message="$2"
echo -e "\e[${color_code}m${message}\e[0m" >&2 printf '\e[%sm%s\e[0m\n' "$color_code" "$message" >&2
} }
loglevel=()
case $1 in case $1 in
-h|--help) -h|--help)
echo "--help, -h show this help message and exit" echo "--help, -h show this help message and exit"
@ -13,7 +15,7 @@ case $1 in
exit 0 exit 0
;; ;;
-L|--loglevel) -L|--loglevel)
loglevel="$1 $2" loglevel=("$1" "$2")
;; ;;
--skip-check-links) --skip-check-links)
skip_check_links=1 skip_check_links=1
@ -38,7 +40,7 @@ color_message 94 "Testing links in documentation..."
cd ../tools/documentation_crawler cd ../tools/documentation_crawler
set +e set +e
scrapy crawl_with_status documentation_crawler $loglevel scrapy crawl_with_status documentation_crawler "${loglevel[@]}"
result=$? result=$?
if [ "$result" = 1 ]; then if [ "$result" = 1 ]; then
color_message 91 "Failed!" color_message 91 "Failed!"