From b0d3861d7300f701f891f0dbdb5c77a88796dc93 Mon Sep 17 00:00:00 2001 From: superwhiskers Date: Mon, 3 Jun 2024 17:31:24 -0400 Subject: [PATCH 1/4] initial implementation of #150, minus adjustments to `CONTRIBUTING.md` - drop dead code within `CMakeLists.txt` - remove old `.github/workflows/.clang-format` - create new `.clang-format` at the repository root, with settings based on observed patterns & `CONTRIBUTING.md` --- .clang-format | 41 +++++++++++++++++++++++++++++++++ .github/workflows/.clang-format | 9 -------- CMakeLists.txt | 6 +---- 3 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 .clang-format delete mode 100644 .github/workflows/.clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..bdd151d7 --- /dev/null +++ b/.clang-format @@ -0,0 +1,41 @@ +Language: Cpp +AccessModifierOffset: 0 +AlignConsecutiveMacros: true +BreakBeforeBraces: Linux +IndentWidth: 2 +ConstructorInitializerIndentWidth: 2 +AlignAfterOpenBracket: Align +Standard: c++11 +IndentAccessModifiers: true +IndentCaseBlocks: true +IndentCaseLabels: true +IndentGotoLabels: true +IndentExternBlock: Indent +UseTab: Never +ReflowComments: true +QualifierAlignment: Left +ReferenceAlignment: Pointer +PointerAlignment: Left +InsertBraces: true +NamespaceIndentation: All +LineEnding: LF +IntegerLiteralSeparator: + Binary: 4 + BinaryMinDigits: 8 + Decimal: 3 + DecimalMinDigits: 4 + Hex: 2 + HexMinDigits: 6 +BreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +AllowShortFunctionsOnASingleLine: None +AllowAllArgumentsOnNextLine: false +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: -1 + - Regex: '.*' + Priority: 0 diff --git a/.github/workflows/.clang-format b/.github/workflows/.clang-format deleted file mode 100644 index b8cef3e9..00000000 --- a/.github/workflows/.clang-format +++ /dev/null @@ -1,9 +0,0 @@ -# Documentation about the style options and their meaning -# https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html - -Language: Cpp -AccessModifierOffset: 0 -AlignConsecutiveMacros: true -BreakBeforeBraces: Linux -ColumnLimit: 150 -ConstructorInitializerIndentWidth: 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c6d6bb5..41f2b8ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,10 +53,6 @@ set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) # Add CMake sources from `cmake` dir list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -# Including clang-format cmake files to do automatic checking of formating -# TODO: Set up clang-format -#include(./cmake/clang-format) - # This will create target `doxygen` for building documentation locally. # For now, this target is intended only for developers who want to test # different documentation configurations. To have Doxygen configuration @@ -153,7 +149,7 @@ configure_package_config_file(./cmake/ReSolveConfig.cmake.in install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ReSolveConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ReSolveConfigVersion.cmake" DESTINATION share/resolve/cmake) - + # Add usage examples add_subdirectory(examples) From 3f61b211a1b376171d740a026e359287a16cfacc Mon Sep 17 00:00:00 2001 From: superwhiskers Date: Mon, 3 Jun 2024 17:50:38 -0400 Subject: [PATCH 2/4] use deprecated template declaration breaking option to support clang-format 16 minimum --- .clang-format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index bdd151d7..46022e31 100644 --- a/.clang-format +++ b/.clang-format @@ -26,7 +26,7 @@ IntegerLiteralSeparator: DecimalMinDigits: 4 Hex: 2 HexMinDigits: 6 -BreakTemplateDeclarations: Yes +AlwaysBreakTemplateDeclarations: true BinPackArguments: false BinPackParameters: false AllowShortFunctionsOnASingleLine: None From ceccebd666e15fa8874098248191026797587884 Mon Sep 17 00:00:00 2001 From: superwhiskers Date: Tue, 11 Jun 2024 15:33:52 -0400 Subject: [PATCH 3/4] integrate suggestions + adjustment to include ordering regex --- .clang-format | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 46022e31..ec379119 100644 --- a/.clang-format +++ b/.clang-format @@ -4,6 +4,7 @@ AlignConsecutiveMacros: true BreakBeforeBraces: Linux IndentWidth: 2 ConstructorInitializerIndentWidth: 2 +ColumnLimit: 0 AlignAfterOpenBracket: Align Standard: c++11 IndentAccessModifiers: true @@ -33,7 +34,7 @@ AllowShortFunctionsOnASingleLine: None AllowAllArgumentsOnNextLine: false IncludeBlocks: Regroup IncludeCategories: - - Regex: '^' Priority: -1 From 8aff4b8de3592dba0c8f060fa828ffb8423d471c Mon Sep 17 00:00:00 2001 From: superwhiskers Date: Tue, 11 Jun 2024 15:35:06 -0400 Subject: [PATCH 4/4] drop integer literal separators --- .clang-format | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.clang-format b/.clang-format index ec379119..f4733e1f 100644 --- a/.clang-format +++ b/.clang-format @@ -20,13 +20,6 @@ PointerAlignment: Left InsertBraces: true NamespaceIndentation: All LineEnding: LF -IntegerLiteralSeparator: - Binary: 4 - BinaryMinDigits: 8 - Decimal: 3 - DecimalMinDigits: 4 - Hex: 2 - HexMinDigits: 6 AlwaysBreakTemplateDeclarations: true BinPackArguments: false BinPackParameters: false