format-code: run all linters before exit

Rather than stop on the first linter that fails, run them all and
collect the results.  Show a summary of all the failing linters
at the end.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6cb7d67c72025ed9e755c35b64bd43a82f066309
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index 64ffcb1..bd7cb10 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -33,6 +33,7 @@
     )
 LINTERS_DISABLED=()
 LINTERS_ENABLED=()
+declare -A LINTERS_FAILED=()
 
 eval set -- "$(getopt -o 'h' --long 'help,list-tools,no-diff,disable:,allow-missing' -n 'format-code.sh' -- "$@")"
 while true; do
@@ -306,9 +307,19 @@
 
     # Call the linter now with all the files.
     echo -e "    ${BLUE}Running $op${NORMAL}"
-    "do_$op" "${LINTER_FILES[@]}"
+    if ! "do_$op" "${LINTER_FILES[@]}" ; then
+        LINTERS_FAILED+=([$op]=1)
+    fi
 done
 
+# Check for failing linters.
+if [ 0 -ne ${#LINTERS_FAILED[@]} ]; then
+    for op in "${!LINTERS_FAILED[@]}"; do
+        echo -e "$op: ${RED}FAILED${NORMAL}"
+    done
+    exit 1
+fi
+
 # Check for differences.
 if [ -z "$OPTION_NO_DIFF" ]; then
     echo -e "    ${BLUE}Result differences...${NORMAL}"