format-code: handle all files are ignored by linter
If all the files applicable to a linter have been ignored, then
we should not call the linter since many executables fail if no
source files are given as arguments.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I014291d807b2ef6be7ec3c5a5d3e7a4ce1de3717
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index bd7cb10..c7bf16c 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -306,9 +306,13 @@
done | "${LOCAL_IGNORE[@]}")
# Call the linter now with all the files.
- echo -e " ${BLUE}Running $op${NORMAL}"
- if ! "do_$op" "${LINTER_FILES[@]}" ; then
- LINTERS_FAILED+=([$op]=1)
+ if [ 0 -ne ${#LINTER_FILES[@]} ]; then
+ echo -e " ${BLUE}Running $op${NORMAL}"
+ if ! "do_$op" "${LINTER_FILES[@]}" ; then
+ LINTERS_FAILED+=([$op]=1)
+ fi
+ else
+ echo -e " ${YELLOW}${op}:${NORMAL} all applicable files are on ignore-lists"
fi
done