From c96e1b2259d1cf05bbda0a6332930f8946cec557 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Sat, 4 Jan 2025 16:57:54 +1100 Subject: [PATCH] Add initial .clang-format Still a work in progress. --- .clang-format | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ .clang-format.sh | 7 +++++ 2 files changed, 81 insertions(+) create mode 100644 .clang-format create mode 100755 .clang-format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..27e2a5f45 --- /dev/null +++ b/.clang-format @@ -0,0 +1,74 @@ +--- +BasedOnStyle: WebKit +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: None +AlignConsecutiveDeclarations: None +AlignConsecutiveMacros: true +AlignEscapedNewlines: LeftWithLastLine +AlignOperands: AlignAfterOperator +AlignTrailingComments: Always +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Always +AllowShortCompoundRequirementOnASingleLine: true +AllowShortIfStatementsOnASingleLine: true +AllowShortFunctionsOnASingleLine: false +AllowShortLoopsOnASingleLine: true +AlwaysBreakBeforeMultilineStrings: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterStruct: false + AfterUnion: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakConstructorInitializers: AfterColon +ColumnLimit: 120 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +IncludeBlocks: Regroup +IncludeCategories: +- CaseSensitive: true + Priority: 2 + Regex: _global\.h"$ + SortPriority: 1 +- CaseSensitive: false + Priority: 2 + Regex: ^" +- CaseSensitive: true + Priority: 3 + Regex: ^& /dev/null + sed -i -Ee "s|^(BasedOnStyle:).*|\1 ${style}|" .clang-format + clang-format -i include/qtpokit/*.h src/*/*.{cpp,h} + printf "%-9s %5d\n" "${style}" "$(git diff | wc -l)" +done