Lint script for only changed files 20/44520/1
authorSeungkeun Lee <sngn.lee@samsung.com>
Thu, 23 Jul 2015 02:28:13 +0000 (11:28 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Thu, 23 Jul 2015 02:28:30 +0000 (11:28 +0900)
Change-Id: I54d5d1fc4d7565f9c32247a8106e213c739912df

build/lint_changed.sh [new file with mode: 0755]

diff --git a/build/lint_changed.sh b/build/lint_changed.sh
new file mode 100755 (executable)
index 0000000..a08e1aa
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+echo "############################# CPP LINT for changed files ##################################"
+
+files=`git status -s | awk 'BEGIN{FILTER="\\.(cc|h)$"} tolower($2) ~ FILTER { print $2  }'`
+exclude_files="picojson.h"
+ret=0
+for x in $files; do
+  if [[ $exclude_files =~ $(basename $x) ]]; then
+    continue
+  fi
+
+    $(dirname $0)/cpplint.py \
+        --filter=-build/header_guard \
+        $x
+    if [ $? -ne 0 ]; then
+        ret=1
+    fi
+done;
+
+echo "############################# LINT DONE ##################################"
+
+exit $ret