Co-authored-by: serprex <159546+serprex@users.noreply.github.com>
This commit is contained in:
amafresh325
2026-10-05 18:54:09 +02:00
committed by GitHub
parent 7cdf69b20b
commit 94f950f8d7
68 changed files with 1138 additions and 1034 deletions
-9
View File
@@ -1,9 +0,0 @@
#!/bin/sh
# Fail if any C/C++ source in soh/ outside soh/include contains a tab.
cd "$(dirname "$0")/.." || exit 2
if git --no-pager grep -n "$(printf '\t')" -- 'soh/*.c' 'soh/*.cpp' 'soh/*.h' 'soh/*.hpp' ':!soh/include'; then
echo "replace tabs with spaces"
exit 1
fi
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# Fail if any C/C++ source in soh/ outside soh/include contains tabs or
# trailing whitespace. Pass --fix to strip trailing whitespace in place
# (tabs still need fixing by hand).
cd "$(dirname "$0")/.." || exit 2
# git grep over the checked sources, extra args go before the file list
grep_sources() {
git --no-pager grep "$@" -- 'soh/*.c' 'soh/*.cpp' 'soh/*.h' 'soh/*.hpp' ':!soh/include'
}
if [ "$1" = "--fix" ]; then
grep_sources -lE '[[:space:]]+$' | xargs -r sed -i -E 's/[[:space:]]+$//'
fi
status=0
if grep_sources -n "$(printf '\t')"; then
echo "replace tabs with spaces"
status=1
fi
if grep_sources -nE '[[:space:]]+$'; then
echo "remove trailing whitespace (or run with --fix)"
status=1
fi
exit $status