diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-17 14:17:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 14:17:20 +0200 |
commit | 680b4878c5bec7cce4424e85a9bd374a945a4d2d (patch) | |
tree | 646a7952fbfc134a3fdce10cdbf33cfb7395c307 | |
parent | 0d61fc2c0f1d7625c866c79b6c4044fbab61a768 (diff) | |
parent | 24ee8c3566c7ef5469df762c1daa21b330e2dd82 (diff) |
Merge pull request #29845 from akien-mga/stylé-comme-jamais
Add script to fix style issues and copyright headers
-rwxr-xr-x | misc/scripts/fix_style.sh | 60 | ||||
-rw-r--r-- | platform/iphone/camera_ios.h | 6 | ||||
-rw-r--r-- | platform/iphone/camera_ios.mm | 6 | ||||
-rw-r--r-- | platform/javascript/http_client.h.inc | 2 | ||||
-rw-r--r-- | platform/osx/camera_osx.h | 6 | ||||
-rw-r--r-- | platform/osx/camera_osx.mm | 6 | ||||
-rw-r--r-- | platform/windows/camera_win.cpp | 6 | ||||
-rw-r--r-- | platform/windows/camera_win.h | 6 | ||||
-rw-r--r-- | scene/resources/default_theme/font_hidpi.inc | 2 | ||||
-rw-r--r-- | scene/resources/default_theme/font_lodpi.inc | 2 | ||||
-rw-r--r-- | servers/camera/camera_feed.cpp | 6 | ||||
-rw-r--r-- | servers/camera/camera_feed.h | 6 | ||||
-rw-r--r-- | servers/camera_server.cpp | 6 | ||||
-rw-r--r-- | servers/camera_server.h | 8 |
14 files changed, 96 insertions, 32 deletions
diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh new file mode 100755 index 0000000000..7a335c21ea --- /dev/null +++ b/misc/scripts/fix_style.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Command line arguments +run_clang_format=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" + +if [ -z "$1" ]; then + echo -e $usage + exit 0 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --clang-format|-c) + run_clang_format=true + ;; + --headers|-h) + run_fix_headers=true + ;; + --all|-a) + run_clang_format=true + run_fix_headers=true + ;; + *) + echo -e $usage + exit 0 + esac + shift +done + +echo "Removing generated files, some have binary data and make clang-format freeze." +find -name "*.gen.*" -delete + +# Apply clang-format +if $run_clang_format; then + # Sync list with pre-commit hook + FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl" + + for extension in ${FILE_EXTS}; do + echo -e "Formatting ${extension} files..." + find \( -path "./.git" \ + -o -path "./thirdparty" \ + -o -path "./platform/android/java/src/com" \ + \) -prune \ + -o -name "*${extension}" \ + -exec clang-format -i {} \; + done +fi + +# Add missing copyright headers +if $run_fix_headers; then + echo "Fixing copyright headers in Godot code files..." + find \( -path "./.git" -o -path "./thirdparty" \) -prune \ + -o -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|m\|mm\|java\)' \ + > tmp-files + cat tmp-files | grep -v ".git\|thirdparty\|theme_data.h\|platform/android/java/src/com\|platform/android/java/src/org/godotengine/godot/input/InputManager" > files + python misc/scripts/fix_headers.py + rm -f tmp-files files +fi diff --git a/platform/iphone/camera_ios.h b/platform/iphone/camera_ios.h index e5d62af65d..cf747283e1 100644 --- a/platform/iphone/camera_ios.h +++ b/platform/iphone/camera_ios.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/iphone/camera_ios.mm b/platform/iphone/camera_ios.mm index 3994e9366a..4c11701fdd 100644 --- a/platform/iphone/camera_ios.mm +++ b/platform/iphone/camera_ios.mm @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc index d707d623ab..c034069ab2 100644 --- a/platform/javascript/http_client.h.inc +++ b/platform/javascript/http_client.h.inc @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/platform/osx/camera_osx.h b/platform/osx/camera_osx.h index ed7a1f0a73..80ca3759ba 100644 --- a/platform/osx/camera_osx.h +++ b/platform/osx/camera_osx.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/osx/camera_osx.mm b/platform/osx/camera_osx.mm index 34486c58b1..f13cf76beb 100644 --- a/platform/osx/camera_osx.mm +++ b/platform/osx/camera_osx.mm @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/windows/camera_win.cpp b/platform/windows/camera_win.cpp index 6eff2749f2..b97796fe89 100644 --- a/platform/windows/camera_win.cpp +++ b/platform/windows/camera_win.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/windows/camera_win.h b/platform/windows/camera_win.h index 61d22ac6b1..22ce9aa43f 100644 --- a/platform/windows/camera_win.h +++ b/platform/windows/camera_win.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/scene/resources/default_theme/font_hidpi.inc b/scene/resources/default_theme/font_hidpi.inc index 2fc0f56c3f..4860149e6b 100644 --- a/scene/resources/default_theme/font_hidpi.inc +++ b/scene/resources/default_theme/font_hidpi.inc @@ -1,3 +1,4 @@ +/* clang-format off */ static const int _hidpi_font_height=25; static const int _hidpi_font_ascent=19; static const int _hidpi_font_charcount=191; @@ -25459,3 +25460,4 @@ static const unsigned char _hidpi_font_img_data[25255]={ 96, 130, }; +/* clang-format on */ diff --git a/scene/resources/default_theme/font_lodpi.inc b/scene/resources/default_theme/font_lodpi.inc index 8eae45a8a7..959e2c1d7b 100644 --- a/scene/resources/default_theme/font_lodpi.inc +++ b/scene/resources/default_theme/font_lodpi.inc @@ -1,3 +1,4 @@ +/* clang-format off */ static const int _lodpi_font_height=14; static const int _lodpi_font_ascent=11; static const int _lodpi_font_charcount=191; @@ -13113,3 +13114,4 @@ static const unsigned char _lodpi_font_img_data[12909]={ 96, 130, }; +/* clang-format on */ diff --git a/servers/camera/camera_feed.cpp b/servers/camera/camera_feed.cpp index b96e9b749f..31b8b2874f 100644 --- a/servers/camera/camera_feed.cpp +++ b/servers/camera/camera_feed.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h index aa8a78b2f6..90c076071c 100644 --- a/servers/camera/camera_feed.h +++ b/servers/camera/camera_feed.h @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp index f52d3decae..8d2ae37001 100644 --- a/servers/camera_server.cpp +++ b/servers/camera_server.cpp @@ -3,10 +3,10 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/servers/camera_server.h b/servers/camera_server.h index c7716a3cff..d204142c7d 100644 --- a/servers/camera_server.h +++ b/servers/camera_server.h @@ -1,12 +1,12 @@ /*************************************************************************/ -/* camera_server.h */ +/* camera_server.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |