From 15ad14a9dcef3a520e3d4c0a48f8648f4d98146a Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Fri, 30 Oct 2015 22:12:31 +0100 Subject: [PATCH] Add linter script which will replace the ad-hoc commands ran by the linter Buildbot. --- Tools/lint.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 Tools/lint.sh diff --git a/Tools/lint.sh b/Tools/lint.sh new file mode 100755 index 0000000000..b399ac71d5 --- /dev/null +++ b/Tools/lint.sh @@ -0,0 +1,37 @@ +#! /bin/sh +# +# Linter script that checks for common style issues in Dolphin's codebase. + +REPO_BASE=$(realpath $(dirname $0)/..) + +fail=0 + +# Step 1: check for includes ordering. +echo "[.] Checking #include statements ordering." +res=$( + ${REPO_BASE}/Tools/check-includes.py \ + $(find ${REPO_BASE}/Source/Core -name "*.cpp" -o -name "*.h") \ + 2>&1 \ + >/dev/null +) +if [ -n "${res}" ]; then + echo "FAIL: ${res}" + fail=1 +else + echo "OK" +fi + +# Step 2: check for trailing whitespaces. +echo "[.] Checking for trailing whitespaces." +res=$( + find ${REPO_BASE}/Source/Core -name "*.cpp" -o -name "*.h" \ + | xargs egrep -n "\s+$" +) +if [ -n "$res" ]; then + echo "FAIL: ${res}" + fail=1 +else + echo "OK" +fi + +exit ${fail}