From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- editor/import/resource_importer_csv.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'editor/import/resource_importer_csv.cpp') diff --git a/editor/import/resource_importer_csv.cpp b/editor/import/resource_importer_csv.cpp index 424f90bd54..e56cb1d3a1 100644 --- a/editor/import/resource_importer_csv.cpp +++ b/editor/import/resource_importer_csv.cpp @@ -34,16 +34,13 @@ #include "core/os/file_access.h" String ResourceImporterCSV::get_importer_name() const { - return "csv"; } String ResourceImporterCSV::get_visible_name() const { - return "CSV"; } void ResourceImporterCSV::get_recognized_extensions(List *p_extensions) const { - p_extensions->push_back("csv"); } @@ -52,12 +49,10 @@ String ResourceImporterCSV::get_save_extension() const { } String ResourceImporterCSV::get_resource_type() const { - return "TextFile"; } bool ResourceImporterCSV::get_option_visibility(const String &p_option, const Map &p_options) const { - return true; } @@ -65,7 +60,6 @@ int ResourceImporterCSV::get_preset_count() const { return 0; } String ResourceImporterCSV::get_preset_name(int p_idx) const { - return ""; } -- cgit v1.2.3 From 07bc4e2f96f8f47991339654ff4ab16acc19d44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 14:29:06 +0200 Subject: Style: Enforce separation line between function definitions I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027. --- editor/import/resource_importer_csv.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'editor/import/resource_importer_csv.cpp') diff --git a/editor/import/resource_importer_csv.cpp b/editor/import/resource_importer_csv.cpp index e56cb1d3a1..d29ba28a96 100644 --- a/editor/import/resource_importer_csv.cpp +++ b/editor/import/resource_importer_csv.cpp @@ -40,6 +40,7 @@ String ResourceImporterCSV::get_importer_name() const { String ResourceImporterCSV::get_visible_name() const { return "CSV"; } + void ResourceImporterCSV::get_recognized_extensions(List *p_extensions) const { p_extensions->push_back("csv"); } @@ -59,6 +60,7 @@ bool ResourceImporterCSV::get_option_visibility(const String &p_option, const Ma int ResourceImporterCSV::get_preset_count() const { return 0; } + String ResourceImporterCSV::get_preset_name(int p_idx) const { return ""; } -- cgit v1.2.3