From 0dfcced14f9c01b66d00a00219acd54026b8c25b Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 15 Nov 2023 02:31:06 -0800 Subject: [PATCH] Make shellcheck happy --- scripts/bin/check-whole-site | 8 +++++--- scripts/bin/hugo-new-note | 1 - scripts/bin/validate-feed | 1 - scripts/get-webmentions.sh | 6 ++++-- scripts/populate-webrings.sh | 1 - scripts/vnu.sh | 6 ++++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/scripts/bin/check-whole-site b/scripts/bin/check-whole-site index 79e16bf..ed7a712 100755 --- a/scripts/bin/check-whole-site +++ b/scripts/bin/check-whole-site @@ -52,7 +52,6 @@ while getopts "hj" flags; do ;; *) bad_option "${flags}" 'invalid option' - exit 1 ;; esac done @@ -61,9 +60,12 @@ base_url="${1-http://localhost:8089}" # HTML validation is already parallelized, so run that single-threaded. make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize copy-to-xhtml validate-html -make -j "$jobs" -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$(curl -sSL "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" & +sitemap_links="$(curl -sSL --compressed "$base_url/sitemap.xml" | htmlq loc -t)" +urls_offline="$(echo "$sitemap_links" | rg -v '/search/$' | tr '\n' ' ')" +make -j "$jobs" -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$urls_offline" & make deploy-staging RSYNCFLAGS_EXTRA=-q -make -f Makefile.online hint-online URLS="$(curl -sSL --compressed https://staging.seirdy.one/sitemap.xml | htmlq loc -t | rg -v '/(?:search|wcag-is-a-starting-point)/$' | sort | tr '\n' ' ')" +urls_online="$(echo "$sitemap_links" | rg -v '/(?:search|wcag-is-a-starting-point)/$' | sort | tr '\n' ' ')" +make -f Makefile.online hint-online URLS="$urls_online" wait # TODO: run lighthouse on every page in the sitemap. diff --git a/scripts/bin/hugo-new-note b/scripts/bin/hugo-new-note index 0a9be99..e918455 100755 --- a/scripts/bin/hugo-new-note +++ b/scripts/bin/hugo-new-note @@ -43,7 +43,6 @@ while getopts "hr" flags; do ;; *) bad_option "${flags}" 'invalid option' - exit 1 ;; esac done diff --git a/scripts/bin/validate-feed b/scripts/bin/validate-feed index b425702..28dedaf 100755 --- a/scripts/bin/validate-feed +++ b/scripts/bin/validate-feed @@ -33,7 +33,6 @@ while getopts "ho" flags; do ;; *) bad_option "${flags}" 'invalid option' - exit 1 ;; esac done diff --git a/scripts/get-webmentions.sh b/scripts/get-webmentions.sh index 12e2948..0039fb0 100644 --- a/scripts/get-webmentions.sh +++ b/scripts/get-webmentions.sh @@ -25,12 +25,14 @@ key() { } token() { - ccurl -sX POST "$auth_url" -d "key=$(key)" + key_response="$(key)" + ccurl -sX POST "$auth_url" -d "key=$key_response" } # use that token to fetch all webmentions fetch_webmentions() { - ccurl --compressed -H "Authorization: Bearer $(token)" "$webmentions_url" -o "$webmentions_file" + token_response="$(token)" + ccurl --compressed -H "Authorization: Bearer $token_response" "$webmentions_url" -o "$webmentions_file" } # fetch webmentions if we don't have a fresh copy already. diff --git a/scripts/populate-webrings.sh b/scripts/populate-webrings.sh index 358d163..260b0f8 100755 --- a/scripts/populate-webrings.sh +++ b/scripts/populate-webrings.sh @@ -51,7 +51,6 @@ while getopts "hd" flags; do ;; *) bad_option "$flags" 'invalid option' - exit 1 ;; esac done diff --git a/scripts/vnu.sh b/scripts/vnu.sh index 5d0efe0..ff8e26f 100644 --- a/scripts/vnu.sh +++ b/scripts/vnu.sh @@ -3,15 +3,17 @@ set -e -u pwd="$(dirname "$0")" output_dir="$1" -files_to_analyze() { +find_files_to_analyze() { find "$output_dir" -type f -name '*.xhtml' -o -name '*.svg' \ | grep -Ev '(bimi\.svg|search/index\.x?html)$' } +files_to_analyze="$(find_files_to_analyze)" + # we skip the BIMI icon (VNU can't handle SVG 1.2) and the search page (it has raw templates). vnu \ --stdout \ --format json \ --also-check-svg \ - $(files_to_analyze) \ + $files_to_analyze \ | sh "$pwd/filter-vnu.sh"