From f269f7aafda2ad451ca55cc959b4c20023580d00 Mon Sep 17 00:00:00 2001 From: David Rabkin Date: Sat, 6 Jan 2024 16:08:45 +0200 Subject: [PATCH] Add redo lint --- .github/styles/Vocab/Base/accept.txt | 2 ++ .gitignore | 4 ++++ README.adoc | 8 +++++++ all.do | 4 ++++ clean.do | 4 ++++ lint.do | 35 ++++++++++++++++++++++++++++ 6 files changed, 57 insertions(+) create mode 100644 all.do create mode 100644 clean.do create mode 100644 lint.do diff --git a/.github/styles/Vocab/Base/accept.txt b/.github/styles/Vocab/Base/accept.txt index f298995..1824724 100644 --- a/.github/styles/Vocab/Base/accept.txt +++ b/.github/styles/Vocab/Base/accept.txt @@ -1 +1,3 @@ +Matveev Rabkin +Sergey diff --git a/.gitignore b/.gitignore index 11789db..8736575 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ .github/styles/proselint .github/styles/Readability .github/styles/write-good +.redo +1 +clean +lint diff --git a/README.adoc b/README.adoc index a67c405..9c5ca54 100644 --- a/README.adoc +++ b/README.adoc @@ -62,6 +62,14 @@ git clone git@github.com:rdavid/toolbox.git && ./toolbox/app/install ---- +== Test + +The project uses Daniel J. Bernstein's build system {url-redo}[`redo`]. +You can install Sergey Matveev's {url-goredo}[`goredo`] implementation. +`redo lint` applies the following linters to the source files: +{url-shellcheck}[`shellcheck`], {url-shfmt}[`shfmt`], {url-typos}[`typos`], +{url-vale}[`vale`], {url-yamllint}[`yamllint`]. + == License `toolbox` is copyright {url-cv}[David Rabkin] and available under a diff --git a/all.do b/all.do new file mode 100644 index 0000000..f63a548 --- /dev/null +++ b/all.do @@ -0,0 +1,4 @@ +# shellcheck shell=sh +# vi:et lbr noet sw=2 ts=2 tw=79 wrap +# Copyright 2024 David Rabkin +redo-ifchange lint diff --git a/clean.do b/clean.do new file mode 100644 index 0000000..22dd31c --- /dev/null +++ b/clean.do @@ -0,0 +1,4 @@ +# shellcheck shell=sh +# vi:et lbr noet sw=2 ts=2 tw=79 wrap +# Copyright 2024 David Rabkin +rm -f 1 clean lint diff --git a/lint.do b/lint.do new file mode 100644 index 0000000..81e42fd --- /dev/null +++ b/lint.do @@ -0,0 +1,35 @@ +# shellcheck shell=sh +# vi:et lbr noet sw=2 ts=2 tw=79 wrap +# Copyright 2024 David Rabkin +redo-ifchange \ + ./*.do \ + .github/*.yml \ + .github/workflows/*.yml \ + app/* \ + README.adoc + +# shellcheck disable=SC2034 # Variable appears unused. +readonly \ + BASE_APP_VERSION=0.9.20240106 \ + BASE_MIN_VERSION=0.9.20231212 \ + BSH=/usr/local/bin/base.sh +[ -r "$BSH" ] || { + printf >&2 Install\ Shellbase.\\n + exit 1 +} +set -- "$@" --quiet + +# shellcheck disable=SC1090 # File not following. +. "$BSH" +cmd_exists shellcheck && + find app -name "*" ! -path app ! -name pass -exec shellcheck {} + +cmd_exists shfmt && { + shfmt -d ./*.do + find app -name "*" ! -path app ! -name pass -exec shfmt -d {} + +} +cmd_exists typos && typos +cmd_exists vale && { + vale sync >/dev/null 2>&1 || : + vale README.adoc +} +cmd_exists yamllint && yamllint .github/*.yml .github/workflows/*.yml