aboutsummaryrefslogtreecommitdiff
path: root/test/check-trailing-whitespace.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/check-trailing-whitespace.sh')
-rwxr-xr-xtest/check-trailing-whitespace.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/check-trailing-whitespace.sh b/test/check-trailing-whitespace.sh
new file mode 100755
index 00000000..4aa4af9a
--- /dev/null
+++ b/test/check-trailing-whitespace.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+top_srcdir=${SOURCE_ROOT:-..}
+. ${top_srcdir}/test/setup_env.sh
+
+ebegin "Checking trailing whitespace in code"
+# XXX: Should we check man pages too ?
+out=$(cd ${top_srcdir}; find */ \
+ '(' -name '*.[ch]' -o -name '*.in' -o -name '*.sh' ')' \
+ -exec grep -n -E '[[:space:]]+$' {} +)
+[ -z "${out}" ]
+eend $? "Trailing whitespace needs to be deleted:"$'\n'"${out}"