diff --git a/.clang-format b/.clang-format index 7109a2362..d857f89c3 100644 --- a/.clang-format +++ b/.clang-format @@ -1,56 +1,50 @@ + BasedOnStyle: Google AlignAfterOpenBracket: AlwaysBreak -AlignConsecutiveAssignments: 'false' -AlignConsecutiveDeclarations: 'false' -AlignEscapedNewlinesLeft: 'true' -AlignOperands: 'false' -AlignTrailingComments: 'true' -AllowShortBlocksOnASingleLine: 'false' -AllowShortCaseLabelsOnASingleLine: 'false' -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: 'false' -AllowShortLoopsOnASingleLine: 'false' -AlwaysBreakAfterDefinitionReturnType: All -AlwaysBreakAfterReturnType: All -AlwaysBreakTemplateDeclarations: 'true' -BreakBeforeBinaryOperators: NonAssignment -BreakBeforeBraces: Custom -BraceWrapping: - AfterCaseLabel: true - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - AfterExternBlock: true - BeforeCatch: true - BeforeElse: true - SplitEmptyFunction: false - SplitEmptyRecord: false - SplitEmptyNamespace: false -BreakBeforeTernaryOperators: 'true' -BreakConstructorInitializersBeforeComma: 'true' -Cpp11BracedListStyle: 'true' -KeepEmptyLinesAtTheStartOfBlocks: 'false' -NamespaceIndentation: All -PenaltyBreakString: '3' +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: AlignAfterOperator +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakTemplateDeclarations: Yes +AlwaysBreakBeforeMultilineStrings: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +Cpp11BracedListStyle: true +KeepEmptyLinesAtTheStartOfBlocks: true +NamespaceIndentation: Inner +CompactNamespaces: true +PenaltyBreakString: 3 SpaceBeforeParens: ControlStatements -SpacesInAngles: 'false' -SpacesInContainerLiterals: 'false' -SpacesInParentheses: 'false' -SpacesInSquareBrackets: 'false' -Standard: Cpp11 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: c++17 UseTab: Never -SortIncludes: false +SortIncludes: true ColumnLimit: 100 +IndentWidth: 4 +AccessModifierOffset: -2 +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 + # treat pointers and reference declarations as if part of the type DerivePointerAlignment: false PointerAlignment: Left # when wrapping function calls/declarations, force each parameter to have its own line -BinPackParameters: 'false' -BinPackArguments: 'false' +BinPackParameters: false +BinPackArguments: false diff --git a/contrib/format.sh b/contrib/format.sh index 88c7037f9..49f9e8907 100755 --- a/contrib/format.sh +++ b/contrib/format.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash -CLANG_FORMAT_DESIRED_VERSION=11 +CLANG_FORMAT_DESIRED_VERSION=14 -TARGET_DIRS=(src/wallet3 src/sqlitedb src/logging) +TARGET_DIRS=(src pybind) + +set -e binary=$(which clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null) if [ $? -ne 0 ]; then