Browse Source

Merge pull request #57505 from akien-mga/ci-scripts-fix-exclude-pattern

Rémi Verschelde 3 years ago
parent
commit
a1469bff19
3 changed files with 5 additions and 21 deletions
  1. 1 1
      misc/scripts/black_format.sh
  2. 2 10
      misc/scripts/clang_format.sh
  3. 2 10
      misc/scripts/clang_tidy.sh

+ 1 - 1
misc/scripts/black_format.sh

@@ -6,7 +6,7 @@ set -uo pipefail
 
 
 # Apply black.
 # Apply black.
 echo -e "Formatting Python files..."
 echo -e "Formatting Python files..."
-PY_FILES=$(git ls-files '*SConstruct' '*SCsub' '*.py' --exclude='.git/*' --exclude='thirdparty/*')
+PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*')
 black -l 120 $PY_FILES
 black -l 120 $PY_FILES
 
 
 diff=$(git diff --color)
 diff=$(git diff --color)

+ 2 - 10
misc/scripts/clang_format.sh

@@ -6,17 +6,9 @@
 set -uo pipefail
 set -uo pipefail
 
 
 # Loops through all code files tracked by Git.
 # Loops through all code files tracked by Git.
-git ls-files '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' |
+git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \
+                ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' |
 while read -r f; do
 while read -r f; do
-    # Exclude some files.
-    if [[ "$f" == "thirdparty"* ]]; then
-        continue
-    elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
-        continue
-    elif [[ "$f" == *"-so_wrap."* ]]; then
-        continue
-    fi
-
     # Run clang-format.
     # Run clang-format.
     clang-format --Wno-error=unknown -i "$f"
     clang-format --Wno-error=unknown -i "$f"
 
 

+ 2 - 10
misc/scripts/clang_tidy.sh

@@ -6,17 +6,9 @@
 set -uo pipefail
 set -uo pipefail
 
 
 # Loops through all code files tracked by Git.
 # Loops through all code files tracked by Git.
-git ls-files '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' |
+git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \
+                ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' |
 while read -r f; do
 while read -r f; do
-    # Exclude some files.
-    if [[ "$f" == "thirdparty"* ]]; then
-        continue
-    elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
-        continue
-    elif [[ "$f" == *"-so_wrap."* ]]; then
-        continue
-    fi
-
     # Run clang-tidy.
     # Run clang-tidy.
     clang-tidy --quiet --fix "$f" &> /dev/null
     clang-tidy --quiet --fix "$f" &> /dev/null