Commit 57a1e893 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Benjamin Walker
Browse files

check_format.sh: enforce newline at end of file



Change-Id: I4fd1338ec3d95ffcd8a0727e87b845399676ccfa
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 9d902384
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -30,4 +30,7 @@ else
	exit 0
fi

git ls-files -z '*.c' '*.cpp' '*.h' '*.txt' '*.md' '*.mk' '*.txt' '*.sh' '*.py' | \
	xargs -0 -P8 -n1 scripts/eofnl

exit 0

scripts/eofnl

0 → 100755
+17 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash
# Make sure file has a trailing newline

f="$1"

if [ -z "$f" ]; then
	echo "usage: $0 <file>"
	exit 1
fi

if [[ -f "$f" && $(tail -c1 "$f") ]]; then
	echo "$f: No newline at end of file"
	echo '' >> "$f"
	exit 1
else
	exit 0
fi