From 6ece04c4c687894545a552ac4c91e0454814d8ec Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Sep 2020 22:44:31 -0400 Subject: [PATCH 1/4] Remove unused .clang-format parameters --- .clang-format | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.clang-format b/.clang-format index 1980f7183b..5be1b795a7 100644 --- a/.clang-format +++ b/.clang-format @@ -2,29 +2,7 @@ BasedOnStyle: Mozilla UseTab: Always IndentWidth: 4 TabWidth: 4 - -#From https://github.com/mozilla/gecko-dev/blob/master/.clang-format -# Prevent the loss of indentation with these macros -MacroBlockBegin: "^\ -NS_INTERFACE_MAP_BEGIN|\ -NS_INTERFACE_TABLE_HEAD|\ -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION|\ -NS_IMPL_CYCLE_COLLECTION_.*_BEGIN|\ -NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED|\ -NS_INTERFACE_TABLE_BEGIN|\ -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED|\ -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED$" -MacroBlockEnd: "^\ -NS_INTERFACE_MAP_END|\ -NS_IMPL_CYCLE_COLLECTION_.*_END|\ -NS_INTERFACE_TABLE_END|\ -NS_INTERFACE_MAP_END_INHERITING|\ -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END_INHERITED|\ -NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED$" - SortIncludes: false - - BreakBeforeBraces: Custom BraceWrapping: AfterEnum: true From 8f4506fd9cd72a3916f3533b540392a8817a93f7 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Sep 2020 22:44:54 -0400 Subject: [PATCH 2/4] Remove format.sh --- format.sh | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100755 format.sh diff --git a/format.sh b/format.sh deleted file mode 100755 index c61a1348af..0000000000 --- a/format.sh +++ /dev/null @@ -1,15 +0,0 @@ -if [ "$1" = "pre-commit" ]; then - git diff --name-only --cached -- | egrep '\.h$|\.cpp$' | awk '/src/' | awk '!/extern/' | xargs "clang-format" -style=file -i - git diff --name-only --cached -- | egrep '\.h$|\.cpp$' | awk '/src/' | awk '!/extern/' | xargs git add -else - find "src" \( -name '*.h' -or -name '*.cpp' \) \( -type d -o -type f \) -print0 | awk '/src/' | awk '!/extern/' | xargs -0 "clang-format" -style=file -i -fi - -filelist=`git ls-files -z --full-name | awk '/src/' | grep '^src' | grep -E '.*\.(cpp|h)'` -for f in $filelist; do - if [ "$1" = "pre-commit" ]; then - clang-format -i -style=file "${f}" - else - clang-format -i -style=file "${f}" && git add "${f}" - fi -done From 02ad41361c574b47e6beadd73aa4fbde2db43e1e Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Sep 2020 22:53:37 -0400 Subject: [PATCH 3/4] Add format target if clang-format is installed --- CMake/Helpers/StaticAnalysis.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMake/Helpers/StaticAnalysis.cmake b/CMake/Helpers/StaticAnalysis.cmake index 8e14b70aeb..bae23e6a4f 100644 --- a/CMake/Helpers/StaticAnalysis.cmake +++ b/CMake/Helpers/StaticAnalysis.cmake @@ -1,9 +1,12 @@ +# Get sources +get_target_property(SOURCES Etterna SOURCES) +list(FILTER SOURCES EXCLUDE REGEX ".icns$") + # cppcheck find_program(CPPCHECK_EXE "cppcheck") if(NOT CPPCHECK_EXE) message(STATUS "cppcheck not found. cppcheck target will not be created.") else() - get_target_property(SOURCES Etterna SOURCES) add_custom_target(cppcheck COMMENT "Running cppcheck" VERBATIM @@ -28,3 +31,16 @@ else() -checks='*' ${SOURCES}) endif() + +# clang-format +find_program(CLANG_FORMAT "clang-format") +if(NOT CLANG_FORMAT) + message(STATUS "clang-format not found. clang-format target will not be created.") +else() + add_custom_target(format + COMMAND ${CLANG_FORMAT} + -i + --style=file + -verbose + ${SOURCES}) +endif() \ No newline at end of file From 636f1a24db65c84467bf6d07b7be72eb7a5c42f7 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Sep 2020 22:55:25 -0400 Subject: [PATCH 4/4] .editorconfig: Remove duplicate definitions, add yml --- .editorconfig | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 897438fe19..c04ef6125a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,5 @@ indent_style = space [*.md] trim_trailing_whitespace = false -[{CMakeLists.txt, *.cmake}] -indent_style = tab -indent_size = 4 \ No newline at end of file +[*.yml] +indent_style = space