mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-10-13 07:25:54 -04:00
German (#7315)
Co-authored-by: serprex <159546+serprex@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
Executable
+26
@@ -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
|
||||
Reference in New Issue
Block a user