From 83489e27666244400f7e58df089dc22beab3e871 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Mon, 8 May 2017 19:20:42 +0100 Subject: [PATCH] lint: Check for newline at EOF --- Tools/lint.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Tools/lint.sh b/Tools/lint.sh index 4dfa619ee8..345cc3fbaa 100755 --- a/Tools/lint.sh +++ b/Tools/lint.sh @@ -4,20 +4,30 @@ fail=0 -# Check for clang-format issues. +# Loop through each modified file. for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do + # Filter them. if ! echo "${f}" | egrep -q "[.](cpp|h|mm)$"; then continue fi if ! echo "${f}" | egrep -q "^Source/Core"; then continue fi + + # Check for clang-format issues. d=$(diff -u "${f}" <(clang-format ${f})) if ! [ -z "${d}" ]; then echo "!!! ${f} not compliant to coding style, here is the fix:" echo "${d}" fail=1 fi + + # Check for newline at EOF. + if [ -n "$(tail -c 1 ${f})" ]; then + echo "!!! ${f} not compliant to coding style:" + echo "Missing newline at end of file" + fail=1 + fi done exit ${fail}