aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/check-docs
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-12-05 20:46:55 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-14 23:05:07 +0100
commit73bf7241e611ea28e7a58584341921d1262afaa1 (patch)
treede7a87d1c8888d6e4309f5cf06f1a82f9e8ec051 /contrib/check-docs
parent2db657b6bdd6394109c8adc32098d3f39c43f03d (diff)
downloadaerc-73bf7241e611ea28e7a58584341921d1262afaa1.tar.gz
lint,validate: fix for openbsd
- Remove GNU specific stuff (ln -v, mktemp --tempdir, grep --color) - Remove GCC specific flags in sendemail-validate (-Warith-conversion) - Add -std=c99 and -Wpedantic and fix the reported warnings. - Explicitly call gmake everywhere. - Run our custom analyzer standalone. Golangci lint plugins are not supported on OpenBSD. Indirect dependency to golang.org/x/mod is required somehow... Reported-by: Johannes Thyssen Tishman <johannes@thyssentishman.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Diffstat (limited to 'contrib/check-docs')
-rwxr-xr-xcontrib/check-docs16
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/check-docs b/contrib/check-docs
index b92ca3c0..dd783a82 100755
--- a/contrib/check-docs
+++ b/contrib/check-docs
@@ -6,14 +6,22 @@ trap "rm -f $tmp" EXIT
global_fail=0
cmd_scd_sed='s/^\*:([a-z][a-z-]*)\*.*/\1/p'
-cmd_go_sed='/^func ([[:alnum:]]\+) Aliases() \[\]string {$/{n; s/", "/ /g; s/.*return \[\]string{"\(.*\)"}/\1/p}'
+cmd_go_sed='/^func ([[:alnum:]][[:alnum:]]*) Aliases() \[\]string {$/{n;
+ s/", "/ /g;
+ s/.*return \[\]string{"\(.*\)"}/\1/p
+}'
+
+grep_color=
+if echo . | grep --color . >/dev/null 2>&1; then
+ grep_color=--color
+fi
fail=0
sed -nre "$cmd_scd_sed" doc/*.scd > "$tmp"
for f in $(find commands -type f -name '*.go'); do
for cmd in $(sed -ne "$cmd_go_sed" "$f"); do
if ! grep -qFx "$cmd" "$tmp"; then
- grep -HnF --color "\"$cmd\"" "$f"
+ grep -HnF $grep_color "\"$cmd\"" "$f"
fail=$((fail+1))
fi
done
@@ -29,7 +37,7 @@ sed -ne "$cmd_go_sed" $(find commands -type f -name '*.go') | tr ' ' '\n' > "$tm
for f in doc/*.scd; do
for cmd in $(sed -nre "$cmd_scd_sed" "$f"); do
if ! grep -qFx "$cmd" "$tmp"; then
- grep -Hn --color "^\\*:$cmd\\*" "$f"
+ grep -Hn $grep_color "^\\*:$cmd\\*" "$f"
fail=$((fail+1))
fi
done
@@ -45,7 +53,7 @@ sed -nre 's/^\*([a-z][a-z-]*)\* = .*/\1/p' doc/*.scd > "$tmp"
for f in $(find config -type f -name '*.go'); do
for opt in $(sed -nre 's/.*`ini:"([a-z][a-z-]*)".*/\1/p' $f); do
if ! grep -qFx "$opt" "$tmp"; then
- grep -HnF --color "\"$opt\"" "$f"
+ grep -HnF $grep_color "\"$opt\"" "$f"
fail=$((fail+1))
fi
done