From 5a4da5f8188e6351e01747423464b572bb3b607b Mon Sep 17 00:00:00 2001 From: Seirdy Date: Sun, 14 Jul 2024 01:19:03 -0400 Subject: [PATCH] Add fflint checks See https://www.fflint.dev/ and https://github.com/FileFormatInfo/fflint --- Makefile | 10 +++++++--- scripts/fflint.sh | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 scripts/fflint.sh diff --git a/Makefile b/Makefile index a23948e..19420b1 100644 --- a/Makefile +++ b/Makefile @@ -97,10 +97,14 @@ html-validate: .validate-feed-notes: scripts/bin/validate-feed file://$(PWD)/$(OUTPUT_DIR)/notes/atom.xml validate-feeds: .validate-feed-main .validate-feed-posts .validate-feed-notes -.PHONY: validate-feeds .validate-feed-main .validate-feed-posts .validate-feed-notes + +fflint: hugo + sh scripts/fflint.sh $(OUTPUT_DIR) + +.PHONY: validate-feeds .validate-feed-main .validate-feed-posts .validate-feed-notes fflint .PHONY: lint-local -lint-local: html-validate validate-html validate-json htmlproofer validate-feeds +lint-local: fflint htmlproofer validate-feeds validate-json html-validate validate-html # dev server, includes future and draft posts .PHONY: serve @@ -195,5 +199,5 @@ lint-and-deploy-staging: deploy-envs: @$(MAKE) HUGO_FLAGS='--gc --ignoreCache' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs xhtmlize @$(MAKE) HUGO_FLAGS='--gc --ignoreCache' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs copy-to-xhtml - @$(MAKE) HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs validate-html html-validate validate-json validate-feeds + @$(MAKE) HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs fflint validate-json validate-feeds validate-html html-validate @$(MAKE) SSHFLAGS='-o KexAlgorithms=curve25519-sha256@libssh.org' HUGO_FLAGS='' USER=seirdy@envs.net WWW_ROOT=/home/seirdy/public_html GEMINI_ROOT=/home/seirdy/public_gemini HUGO_BASEURL='https://envs.net/~seirdy/' OUTPUT_DIR=public_envs deploy diff --git a/scripts/fflint.sh b/scripts/fflint.sh new file mode 100644 index 0000000..91d7182 --- /dev/null +++ b/scripts/fflint.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +#fflint json --show-tests all --show-detail "$output_dir/**/*.json" +set -e -u +output_dir="$1" + +fflint_wrapper() { + fflint --fail-fast --progress=false --show-tests failing $* +} + +cd "$output_dir" +find '.' -type f -name "*.jpg" | fflint_wrapper --height 1-1500 --width 1-1500 jpeg @- +find '.' -type f -name "*.png" | fflint_wrapper --height 1-1500 --width 1-1500 png @- +find '.' -type f -name "*.json" -o -name ".webmanifest" | fflint_wrapper json @- +find '.' -type f -name "*.html" | fflint_wrapper html @- +find '.' -type f -name "*.svg" | fflint_wrapper --height 1-1500 --width 1-1500 svg @- +find '.' -type f -name "*.txt" -o -name "*.gmi" -o -name "*.asc" | fflint_wrapper text @- +find '.' -type f -name "*.xhtml" -o -name "*.xml" | fflint_wrapper xml @-