commit 8d3e5122e27c8b742d3c0bd33878615d5ccf9197
parent 2a8e75d5e1cd59a47fa27fafd1ae07df87f96e60
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 22 Dec 2024 11:23:01 +0100
add hook from exchange to merchant
Diffstat:
2 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/contrib/ci/jobs/0-codespell/job.sh b/contrib/ci/jobs/0-codespell/job.sh
@@ -20,6 +20,7 @@ ChangeLog
configure*
config.status
config.guess
+config.sub
depcomp
*/contrib/*
*/contrib/hellos/**
diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
@@ -1,15 +1,18 @@
-#!/bin/sh
+#!/bin/bash
# use as .git/hooks/pre-commit
-
exec 1>&2
RET=0
-# Note: we exclude src/mustach from our indentation rules as
-# this is the virtually unchanged copylib of mustach
-changed=$(git diff --cached --name-only) | grep -v mustach
+changed=$(git diff --cached --name-only | grep -v mustach)
crustified=""
+# If nothing (important) has changed, return here
+[ -z "$changed" ] && exit 0
+
+( echo "$changed" | grep -q '\.[ch] *$*') && \
+ echo "Checking formatting with uncrustify..."
+
for f in $changed;
do
if echo $f | grep \\.[c,h]\$ > /dev/null
@@ -31,7 +34,38 @@ done
if [ $RET = 1 ];
then
echo "Run"
- echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}"
+ echo "uncrustify --replace -c uncrustify.cfg ${crustified}"
echo "before committing."
+ exit $RET
+fi
+
+# Make sure we have no stupid spelling error
+if (which codespell > /dev/null)
+then
+ export REPORT=$(mktemp /tmp/codespellXXXXXX)
+ ( set -o pipefail;
+ echo "Checking for spelling errors with codespell..."
+ contrib/ci/jobs/0-codespell/job.sh src 2> ${REPORT};
+ ) || { echo "Please fix the code spell errors in ${REPORT} first"; exit 2; }
+else
+ echo "No codespell installed, skipping spell check."
+ echo "** Please consider installing codespell! **"
fi
-exit $RET
+
+
+# Make sure doxygen is happy with our annotations
+if (which doxygen > /dev/null)
+then
+ export REPORT=$(mktemp /tmp/doxygenXXXXXX)
+ [ -f doc/doxygen/Makefile ] && \
+ ( set -o pipefail;
+ echo "Checking that doxygen is happy..."
+ cd doc/doxygen;
+ make fast 2>&1 | tee ${REPORT} | (grep error:; exit 0);
+ ) || { echo "Please fix the errors reported by doxygen in ${REPORT} first"; exit 3; }
+else
+ echo "No doxygen installed, skipping check."
+ echo "** Please consider installing doxygen! **"
+fi
+
+echo "Commit is all clear!"