Return failure code when lint fails.
authorRobert Konigsberg <konigsberg@google.com>
Sun, 17 Feb 2013 12:57:33 +0000 (07:57 -0500)
committerRobert Konigsberg <konigsberg@google.com>
Sun, 17 Feb 2013 12:57:33 +0000 (07:57 -0500)
lint.sh

diff --git a/lint.sh b/lint.sh
index d349e7c..ef4dacd 100755 (executable)
--- a/lint.sh
+++ b/lint.sh
@@ -18,6 +18,8 @@ if [ $# -gt 1 ]; then
   exit 1
 fi
 
+RETURN_VALUE=0
+
 if [ $# -eq 0 ]; then
   files=$(ls dygraph*.js plugins/*.js | grep -v combined | grep -v dev.js| grep -v externs)
 else
@@ -28,7 +30,7 @@ if [ -e /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources
   # use JSC (Safari/JavaScriptCore) to run JSHint -- much faster than Rhino.
   echo 'Running JSHint w/ JavaScriptCore (jsc)...'
   for file in $files; do
-    ./jshint/env/jsc.sh $file $jsc_opts
+    ./jshint/env/jsc.sh $file $jsc_opts || RETURN_VALUE=1
   done
 else
   # fall back to Rhino.
@@ -40,8 +42,11 @@ else
     if [[ ${ERRORS} -ne 0 ]]; then
       echo "[jshint] Error(s) in ${FILE}:"
       printf "%s\n" "${LINT_RESULT}"
+      RETURN_VALUE=1
     else
       echo "[jshint] ${FILE} passed!"
     fi
   done
 fi
+
+exit $RETURN_VALUE