summaryrefslogtreecommitdiff
path: root/misc/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'misc/scripts')
-rwxr-xr-xmisc/scripts/codespell.sh2
-rwxr-xr-xmisc/scripts/dotnet_format.sh7
-rwxr-xr-xmisc/scripts/header_guards.sh17
-rw-r--r--misc/scripts/mypy.ini11
-rwxr-xr-xmisc/scripts/mypy_check.sh6
5 files changed, 42 insertions, 1 deletions
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index f99c5d22b2..4cc01ec637 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"
+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/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/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 .