From 80821d2d502349b16d6d0ee1e6e562eeb362884e Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Sat, 24 Jun 2023 14:07:26 +0200 Subject: [PATCH] Paar eerste scripts tbv toekomstige kwaliteitscontrole --- scripts/check-all-links.sh | 25 +++++++++++++++++++++++++ scripts/check-canary.sh | 7 +++++++ scripts/check-spelling.sh | 14 ++++++++++++++ 3 files changed, 46 insertions(+) create mode 100755 scripts/check-all-links.sh create mode 100755 scripts/check-canary.sh create mode 100755 scripts/check-spelling.sh diff --git a/scripts/check-all-links.sh b/scripts/check-all-links.sh new file mode 100755 index 0000000..09826bd --- /dev/null +++ b/scripts/check-all-links.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +if [ -f ./check-all-links.tmp ]; then rm ./check-all-links.tmp; fi + +if [ -d ./public ]; then + grep -ri --only-matching --no-filename "https://[a-zA-Z0-9]*\.\([a-z0-9\.\_/~-]\)*" ./public | grep "^http" | sed 's/\\n.*//g' | sort --unique > check-all-links.tmp + for URL in $(cat ./check-all-links.tmp); do + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "${URL}") + if [ ! "${HTTP_CODE}" = "200" ]; then + echo "[WARNING] ${URL} (HTTP: ${HTTP_CODE})" + fi + sleep 5 + done + +else + echo "Dit script dient gedraaid te worden in de hoofddirectory van de website." + exit 1 +fi + +if [ -f ./check-all-links.tmp ]; then rm ./check-all-links.tmp; fi + +exit 0 +# EOF diff --git a/scripts/check-canary.sh b/scripts/check-canary.sh new file mode 100755 index 0000000..9236ced --- /dev/null +++ b/scripts/check-canary.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +grep -r '🐦' ./public + +grep -ri 'placeholder' ./public diff --git a/scripts/check-spelling.sh b/scripts/check-spelling.sh new file mode 100755 index 0000000..9d0aada --- /dev/null +++ b/scripts/check-spelling.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -eu + +if [ -d ./public ]; then + find ./public -name "*.html" -exec sed -e "s/<[^>]*>/ /g" {} + > plaintext.txt + if [ -f plaintext.txt ]; then + aspell --lang=nl check plaintext.txt + fi +else + echo "Run from root directory of website project. Something like ./scripts/$0" +fi + +# EOF