mirror of
https://github.com/godotengine/godot.git
synced 2025-02-16 07:40:36 +00:00
Style: Add black format to fix_style.sh
Also ignore new Android build artifact.
This commit is contained in:
parent
ece425ace4
commit
0926c192e8
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ local.properties
|
|||||||
.idea
|
.idea
|
||||||
.gradletasknamecache
|
.gradletasknamecache
|
||||||
project.properties
|
project.properties
|
||||||
|
platform/android/java/lib/.cxx/
|
||||||
platform/android/java/libs/*
|
platform/android/java/libs/*
|
||||||
platform/android/java/app/libs/*
|
platform/android/java/app/libs/*
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Command line arguments
|
# Command line arguments
|
||||||
|
run_black=false
|
||||||
run_clang_format=false
|
run_clang_format=false
|
||||||
run_fix_headers=false
|
run_fix_headers=false
|
||||||
usage="Invalid argument. Usage:\n$0 <option>\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
|
usage="Invalid argument. Usage:\n$0 <option>\n\t--black|-b\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo -e $usage
|
echo -e $usage
|
||||||
@ -12,6 +13,9 @@ fi
|
|||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--black|-b)
|
||||||
|
run_black=true
|
||||||
|
;;
|
||||||
--clang-format|-c)
|
--clang-format|-c)
|
||||||
run_clang_format=true
|
run_clang_format=true
|
||||||
;;
|
;;
|
||||||
@ -19,6 +23,7 @@ while [ $# -gt 0 ]; do
|
|||||||
run_fix_headers=true
|
run_fix_headers=true
|
||||||
;;
|
;;
|
||||||
--all|-a)
|
--all|-a)
|
||||||
|
run_black=true
|
||||||
run_clang_format=true
|
run_clang_format=true
|
||||||
run_fix_headers=true
|
run_fix_headers=true
|
||||||
;;
|
;;
|
||||||
@ -32,6 +37,19 @@ done
|
|||||||
echo "Removing generated files, some have binary data and make clang-format freeze."
|
echo "Removing generated files, some have binary data and make clang-format freeze."
|
||||||
find -name "*.gen.*" -delete
|
find -name "*.gen.*" -delete
|
||||||
|
|
||||||
|
# Apply black
|
||||||
|
if $run_black; then
|
||||||
|
echo -e "Formatting Python files..."
|
||||||
|
PY_FILES=$(find \( -path "./.git" \
|
||||||
|
-o -path "./thirdparty" \
|
||||||
|
\) -prune \
|
||||||
|
-o \( -name "SConstruct" \
|
||||||
|
-o -name "SCsub" \
|
||||||
|
-o -name "*.py" \
|
||||||
|
\) -print)
|
||||||
|
black -l 120 $PY_FILES
|
||||||
|
fi
|
||||||
|
|
||||||
# Apply clang-format
|
# Apply clang-format
|
||||||
if $run_clang_format; then
|
if $run_clang_format; then
|
||||||
# Sync list with pre-commit hook
|
# Sync list with pre-commit hook
|
||||||
|
Loading…
Reference in New Issue
Block a user