dolphin/Tools/lint.sh
Léo Lam 671c0bc06f Tools: Don't run lint on deleted files
Generates a harmless "No such file or directory" otherwise when a file
is removed in a commit.
2016-07-26 00:51:10 +02:00

24 lines
540 B
Bash
Executable File

#! /bin/bash
#
# Linter script that checks for common style issues in Dolphin's codebase.
fail=0
# Check for clang-format issues.
for f in $(git diff --name-only --diff-filter=ACMRTUXB | awk '{print $2}'); do
if ! echo "${f}" | egrep -q "[.](cpp|h|mm)$"; then
continue
fi
if ! echo "${f}" | egrep -q "^Source/Core"; then
continue
fi
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
done
exit ${fail}