From 2f8e5d8a4d79d883fd9d256293e163db6625ffba Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Wed, 15 Jun 2022 19:43:01 -0700 Subject: [PATCH] Use Equal Access to checl whole site --- .gitignore | 1 + Makefile | 11 ++++-- Makefile.online | 6 +++- scripts/bin/check-whole-site | 65 ++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100755 scripts/bin/check-whole-site diff --git a/.gitignore b/.gitignore index 7aaaa17..e0499c4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ public/ public_*/ .hugo_build.lock csv/webrings.csv +results/ diff --git a/Makefile b/Makefile index 9adbb5e..649dd5a 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,13 @@ lint-css: $(CSS_DIR)/*.css pnpm -s dlx stylelint --config linter-configs/stylelintrc.json --di --rd --rdd $(CSS_DIR)/*.css @#csslint --quiet $(CSS_DIR) -.PHONY: lint-html -lint-html: +.PHONY: validate-json +validate-json: + jq -reM '""' $(OUTPUT_DIR)/manifest.min.*.webmanifest 1>/dev/null + jq -reM '""' $(OUTPUT_DIR)/webfinger.json 1>/dev/null + +.PHONY: validate-html +validate-html: $(VNU) --stdout --format json --skip-non-html --also-check-svg $(OUTPUT_DIR) | sh scripts/filter-vnu.sh .PHONY: hint @@ -53,7 +58,7 @@ hint: hugo .hintrc-local rm .hintrc-local .PHONY: lint-local -lint-local: lint-css lint-html +lint-local: validate-html validate-json lint-css # dev server, includes future and draft posts .PHONY: serve diff --git a/Makefile.online b/Makefile.online index 057012e..fae4b9c 100644 --- a/Makefile.online +++ b/Makefile.online @@ -19,12 +19,16 @@ hint-online: hint --config linter-configs/hintrc -f codeframe $(URL) lighthouse: mkdir -p $(CHROME_PROFILE) - CHROME_PATH=$(CHROME_PATH) CHROME_PROFILE=$(CHROME_PROFILE) JS_FLAGS='' lighthouse $(URL) $(LIGHTHOUSE_ARGS) + CHROME_PATH=$(CHROME_PATH) CHROME_PROFILE=$(CHROME_PROFILE) JS_FLAGS='' lighthouse $(URLS) $(LIGHTHOUSE_ARGS) rm -rf $(CHROME_PROFILE) redbot: redbot_cli -a $(URL) axe: axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors +equal-access: + @echo $(URLS) | tr ' ' '\n' >urls.txt + achecker --reportLevels violation,recommendation,potentialrecommendation urls.txt + rm urls.txt all: lighthouse hint-online diff --git a/scripts/bin/check-whole-site b/scripts/bin/check-whole-site new file mode 100755 index 0000000..5d58a14 --- /dev/null +++ b/scripts/bin/check-whole-site @@ -0,0 +1,65 @@ +#!/usr/bin/env dash + +set -e -u + +# the name of this program +progname="$(basename "${0}")" + +help_text="Usage: + +Validate the site's markup, CSS, and accessibility. + +Uses xmllint to to check well-formedness and the Nu HTML Checker to +check (X)HTML5 and CSS validity on every markup file (inc. HTML, XHTML, +SVG). (xmllint is only relevant if you're using XML syntax). + +Lints source CSS files with stylelint. + +Uses both axe-core and the IBM Equal Access Checker to test +accessibility on every page in the sitemap. + +Options: + -h Print this help and exit + -b Base URL of site +" + +# TODO: add the following: +# - check broken internal links +# - check broken webring links +# - validate JSON (web app manifest, webfinger) + +usage() { + printf '%s' "${help_text}" +} + +# when the user passess bad args, send a msg to stderr and exit +# usage: bad_option