From 269e7a07b4db438df7d665e545ad6039a6f1075e Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 17 Dec 2023 14:50:42 +0100 Subject: [PATCH] chore: Unify `.clang-format` file (#5037) * chore: Unify all .clang-format files in the root dir * Update `scripts/check-format.sh` to include all source dirs * Add changelog entry --- benchmarks/.clang-format => .clang-format | 0 CHANGELOG.md | 1 + mocks/.clang-format | 52 ----------------------- scripts/check-format.sh | 2 +- src/.clang-format | 52 ----------------------- tests/.clang-format | 52 ----------------------- 6 files changed, 2 insertions(+), 157 deletions(-) rename benchmarks/.clang-format => .clang-format (100%) delete mode 100644 mocks/.clang-format delete mode 100644 src/.clang-format delete mode 100644 tests/.clang-format diff --git a/benchmarks/.clang-format b/.clang-format similarity index 100% rename from benchmarks/.clang-format rename to .clang-format diff --git a/CHANGELOG.md b/CHANGELOG.md index d79d963b1..f2bc1ea2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ - Dev: Move `clang-tidy` checker to its own CI job. (#4996) - Dev: Refactored the Image Uploader feature. (#4971) - Dev: Fixed deadlock and use-after-free in tests. (#4981) +- Dev: Moved all `.clang-format` files to the root directory. (#5037) - Dev: Load less message history upon reconnects. (#5001, #5018) - Dev: Load less message history upon reconnects. (#5001) - Dev: BREAKING: Replace custom `import()` with normal Lua `require()`. (#5014) diff --git a/mocks/.clang-format b/mocks/.clang-format deleted file mode 100644 index 0feaad9dc..000000000 --- a/mocks/.clang-format +++ /dev/null @@ -1,52 +0,0 @@ -Language: Cpp - -AccessModifierOffset: -4 -AlignEscapedNewlinesLeft: true -AllowShortFunctionsOnASingleLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLambdasOnASingleLine: Empty -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: false -AlwaysBreakBeforeMultilineStrings: false -BasedOnStyle: Google -BraceWrapping: - AfterClass: "true" - AfterControlStatement: "true" - AfterFunction: "true" - AfterNamespace: "false" - BeforeCatch: "true" - BeforeElse: "true" -BreakBeforeBraces: Custom -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 80 -ConstructorInitializerAllOnOneLineOrOnePerLine: false -DerivePointerBinding: false -FixNamespaceComments: true -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -IndentPPDirectives: AfterHash -SortIncludes: CaseInsensitive -IncludeBlocks: Regroup -IncludeCategories: - # Project includes - - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' - Priority: 1 - # Qt includes - - Regex: '^$' - Priority: 3 - CaseSensitive: true - # LibCommuni includes - - Regex: "^$" - Priority: 3 - # Standard library includes - - Regex: "^<[a-zA-Z_]+>$" - Priority: 4 - # Third party library includes - - Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$" - Priority: 3 -NamespaceIndentation: Inner -PointerBindsToType: false -SpacesBeforeTrailingComments: 2 -Standard: Auto -ReflowComments: false diff --git a/scripts/check-format.sh b/scripts/check-format.sh index e7722ed6f..1d786901c 100755 --- a/scripts/check-format.sh +++ b/scripts/check-format.sh @@ -11,7 +11,7 @@ while read -r file; do echo "$file differs!!!!!!!" fail="1" fi -done < <(find src/ -type f \( -iname "*.hpp" -o -iname "*.cpp" \)) +done < <(find src/ tests/src benchmarks/src mocks/include -type f \( -iname "*.hpp" -o -iname "*.cpp" \)) if [ "$fail" = "1" ]; then echo "At least one file is poorly formatted - check the output above" diff --git a/src/.clang-format b/src/.clang-format deleted file mode 100644 index 0feaad9dc..000000000 --- a/src/.clang-format +++ /dev/null @@ -1,52 +0,0 @@ -Language: Cpp - -AccessModifierOffset: -4 -AlignEscapedNewlinesLeft: true -AllowShortFunctionsOnASingleLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLambdasOnASingleLine: Empty -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: false -AlwaysBreakBeforeMultilineStrings: false -BasedOnStyle: Google -BraceWrapping: - AfterClass: "true" - AfterControlStatement: "true" - AfterFunction: "true" - AfterNamespace: "false" - BeforeCatch: "true" - BeforeElse: "true" -BreakBeforeBraces: Custom -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 80 -ConstructorInitializerAllOnOneLineOrOnePerLine: false -DerivePointerBinding: false -FixNamespaceComments: true -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -IndentPPDirectives: AfterHash -SortIncludes: CaseInsensitive -IncludeBlocks: Regroup -IncludeCategories: - # Project includes - - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' - Priority: 1 - # Qt includes - - Regex: '^$' - Priority: 3 - CaseSensitive: true - # LibCommuni includes - - Regex: "^$" - Priority: 3 - # Standard library includes - - Regex: "^<[a-zA-Z_]+>$" - Priority: 4 - # Third party library includes - - Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$" - Priority: 3 -NamespaceIndentation: Inner -PointerBindsToType: false -SpacesBeforeTrailingComments: 2 -Standard: Auto -ReflowComments: false diff --git a/tests/.clang-format b/tests/.clang-format deleted file mode 100644 index 0feaad9dc..000000000 --- a/tests/.clang-format +++ /dev/null @@ -1,52 +0,0 @@ -Language: Cpp - -AccessModifierOffset: -4 -AlignEscapedNewlinesLeft: true -AllowShortFunctionsOnASingleLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLambdasOnASingleLine: Empty -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: false -AlwaysBreakBeforeMultilineStrings: false -BasedOnStyle: Google -BraceWrapping: - AfterClass: "true" - AfterControlStatement: "true" - AfterFunction: "true" - AfterNamespace: "false" - BeforeCatch: "true" - BeforeElse: "true" -BreakBeforeBraces: Custom -BreakConstructorInitializersBeforeComma: true -ColumnLimit: 80 -ConstructorInitializerAllOnOneLineOrOnePerLine: false -DerivePointerBinding: false -FixNamespaceComments: true -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -IndentPPDirectives: AfterHash -SortIncludes: CaseInsensitive -IncludeBlocks: Regroup -IncludeCategories: - # Project includes - - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' - Priority: 1 - # Qt includes - - Regex: '^$' - Priority: 3 - CaseSensitive: true - # LibCommuni includes - - Regex: "^$" - Priority: 3 - # Standard library includes - - Regex: "^<[a-zA-Z_]+>$" - Priority: 4 - # Third party library includes - - Regex: "^<([a-zA-Z_0-9-]+/)*[a-zA-Z_0-9-]+.h(pp)?>$" - Priority: 3 -NamespaceIndentation: Inner -PointerBindsToType: false -SpacesBeforeTrailingComments: 2 -Standard: Auto -ReflowComments: false