lint: Check for newline at EOF
This commit is contained in:
parent
59dab8b15c
commit
83489e2766
|
@ -4,20 +4,30 @@
|
||||||
|
|
||||||
fail=0
|
fail=0
|
||||||
|
|
||||||
# Check for clang-format issues.
|
# Loop through each modified file.
|
||||||
for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
|
for f in $(git diff --name-only --diff-filter=ACMRTUXB --cached); do
|
||||||
|
# Filter them.
|
||||||
if ! echo "${f}" | egrep -q "[.](cpp|h|mm)$"; then
|
if ! echo "${f}" | egrep -q "[.](cpp|h|mm)$"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if ! echo "${f}" | egrep -q "^Source/Core"; then
|
if ! echo "${f}" | egrep -q "^Source/Core"; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check for clang-format issues.
|
||||||
d=$(diff -u "${f}" <(clang-format ${f}))
|
d=$(diff -u "${f}" <(clang-format ${f}))
|
||||||
if ! [ -z "${d}" ]; then
|
if ! [ -z "${d}" ]; then
|
||||||
echo "!!! ${f} not compliant to coding style, here is the fix:"
|
echo "!!! ${f} not compliant to coding style, here is the fix:"
|
||||||
echo "${d}"
|
echo "${d}"
|
||||||
fail=1
|
fail=1
|
||||||
fi
|
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
|
done
|
||||||
|
|
||||||
exit ${fail}
|
exit ${fail}
|
||||||
|
|
Loading…
Reference in New Issue