summaryrefslogtreecommitdiff
path: root/misc/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'misc/scripts')
-rwxr-xr-xmisc/scripts/clang_format.sh4
-rwxr-xr-xmisc/scripts/codespell.sh4
-rwxr-xr-xmisc/scripts/compare_extension_api.py11
-rwxr-xr-xmisc/scripts/dotnet_format.sh7
-rwxr-xr-xmisc/scripts/file_format.sh4
-rwxr-xr-xmisc/scripts/header_guards.sh17
-rw-r--r--misc/scripts/mypy.ini11
-rwxr-xr-xmisc/scripts/mypy_check.sh6
8 files changed, 48 insertions, 16 deletions
diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh
index b7c577d5fb..edecdb6ecb 100755
--- a/misc/scripts/clang_format.sh
+++ b/misc/scripts/clang_format.sh
@@ -7,8 +7,8 @@ set -uo pipefail
# Loops through all code files tracked by Git.
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.*' \
- ':!:tests/python_build/*' |
+ ':!:.git/*' ':!:thirdparty/*' ':!:*/thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' \
+ ':!:*-so_wrap.*' ':!:tests/python_build/*' |
while read -r f; do
# Run clang-format.
clang-format --Wno-error=unknown -i "$f"
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index f99c5d22b2..c00d897666 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-SKIP_LIST="./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
-IGNORE_LIST="ba,childs,complies,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varius,varn"
+SKIP_LIST="./.git,./bin,./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/dist/linux/org.godotengine.Godot.desktop,./misc/scripts/codespell.sh"
+IGNORE_LIST="alo,ba,childs,complies,curvelinear,doubleclick,expct,fave,findn,gird,gud,inout,lod,nd,numer,ois,readded,ro,sav,statics,te,varius,varn,wan"
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"
diff --git a/misc/scripts/compare_extension_api.py b/misc/scripts/compare_extension_api.py
deleted file mode 100755
index f96db4278c..0000000000
--- a/misc/scripts/compare_extension_api.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import sys
-
-# TODO:
-# Add a process that compares the original godot-cpp/godot-headers/extension_api.json with the new extension_api.json (both passed as arguments) and reports any API calls that have been removed.
-# If we only have additions or no changes to the file, we pass
-# For now we deem this too early because the API isn't stable enough yet.
-
-sys.exit(0)
diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh
index 645737f419..cc34137a37 100755
--- a/misc/scripts/dotnet_format.sh
+++ b/misc/scripts/dotnet_format.sh
@@ -5,6 +5,13 @@
set -uo pipefail
+# Create dummy generated files.
+echo "<Project />" > modules/mono/SdkPackageVersions.props
+mkdir -p modules/mono/glue/GodotSharp/GodotSharp/Generated
+echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharp/Generated/GeneratedIncludes.props
+mkdir -p modules/mono/glue/GodotSharp/GodotSharpEditor/Generated
+echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GeneratedIncludes.props
+
# Loops through all C# projects tracked by Git.
git ls-files -- '*.csproj' \
':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' |
diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh
index 1200b96ea0..a2f33692f9 100755
--- a/misc/scripts/file_format.sh
+++ b/misc/scripts/file_format.sh
@@ -31,7 +31,9 @@ while IFS= read -rd '' f; do
continue
elif [[ "$f" == *"po" ]]; then
continue
- elif [[ "$f" == "thirdparty"* ]]; then
+ elif [[ "$f" == "thirdparty/"* ]]; then
+ continue
+ elif [[ "$f" == *"/thirdparty/"* ]]; then
continue
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
continue
diff --git a/misc/scripts/header_guards.sh b/misc/scripts/header_guards.sh
index 9a830f3ad2..9fdc864f8c 100755
--- a/misc/scripts/header_guards.sh
+++ b/misc/scripts/header_guards.sh
@@ -5,11 +5,15 @@ if [ ! -f "version.py" ]; then
echo "Some of the paths checks may not work as intended from a different folder."
fi
+files_invalid_guard=""
+
for file in $(find -name "thirdparty" -prune -o -name "*.h" -print); do
# Skip *.gen.h and *-so_wrap.h, they're generated.
if [[ "$file" == *".gen.h" || "$file" == *"-so_wrap.h" ]]; then continue; fi
# Has important define before normal header guards.
if [[ "$file" == *"thread.h" || "$file" == *"platform_config.h" ]]; then continue; fi
+ # Obj-C files don't use header guards.
+ if grep -q "#import " "$file"; then continue; fi
bname=$(basename $file .h)
@@ -43,8 +47,21 @@ for file in $(find -name "thirdparty" -prune -o -name "*.h" -print); do
sed -i $file -e "$ s/#endif.*/\n#endif \/\/ $guard/"
# Removes redundant \n added before, if they weren't needed.
sed -i $file -e "/^$/N;/^\n$/D"
+
+ # Check that first ifndef (should be header guard) is at the expected position.
+ # If not it can mean we have some code before the guard that should be after.
+ # "31" is the expected line with the copyright header.
+ first_ifndef=$(grep -n -m 1 "ifndef" $file | sed 's/\([0-9]*\).*/\1/')
+ if [[ "$first_ifndef" != "31" ]]; then
+ files_invalid_guard+="$file\n"
+ fi
done
+if [[ ! -z "$files_invalid_guard" ]]; then
+ echo -e "The following files were found to have potentially invalid header guard:\n"
+ echo -e "$files_invalid_guard"
+fi
+
diff=$(git diff --color)
# If no diff has been generated all is OK, clean up, and exit.
diff --git a/misc/scripts/mypy.ini b/misc/scripts/mypy.ini
new file mode 100644
index 0000000000..c1ea695ca5
--- /dev/null
+++ b/misc/scripts/mypy.ini
@@ -0,0 +1,11 @@
+[mypy]
+ignore_missing_imports = true
+disallow_any_generics = True
+pretty = True
+show_column_numbers = True
+warn_redundant_casts = True
+warn_return_any = True
+warn_unreachable = True
+
+namespace_packages = True
+explicit_package_bases = True
diff --git a/misc/scripts/mypy_check.sh b/misc/scripts/mypy_check.sh
new file mode 100755
index 0000000000..2a06486d67
--- /dev/null
+++ b/misc/scripts/mypy_check.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+set -uo pipefail
+
+echo -e "Python: mypy static analysis..."
+mypy --config-file=./misc/scripts/mypy.ini .