Sfoglia il codice sorgente

Meta: update lint-shell-scripts.sh so that it does not search in Build/

We now use git-ls-files(1) instead of find(1).
Emanuele Torre 5 anni fa
parent
commit
d963be795d
1 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 7 7
      Meta/lint-shell-scripts.sh

+ 7 - 7
Meta/lint-shell-scripts.sh

@@ -6,19 +6,19 @@ cd "$script_path/.."
 
 
 ERRORS=()
 ERRORS=()
 
 
-for f in $(find . -path ./Root -prune -o \
-    -path ./Ports -prune -o \
-    -path ./.git -prune -o \
-    -path ./Toolchain -prune -o \
-    -type f | sort -u); do
+while IFS= read -r f; do
     if file "$f" | grep --quiet shell; then
     if file "$f" | grep --quiet shell; then
         {
         {
             shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f"
             shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f"
         } || {
         } || {
             ERRORS+=("$f")
             ERRORS+=("$f")
         }
         }
-fi
-done
+    fi
+done < <(git ls-files -- \
+    '*.sh' \
+    ':!:Toolchain' \
+    ':!:Ports' \
+)
 
 
 if (( ${#ERRORS[@]} )); then
 if (( ${#ERRORS[@]} )); then
     echo "Files failing shellcheck: ${ERRORS[*]}"
     echo "Files failing shellcheck: ${ERRORS[*]}"