|
| 1 | +# @file .clang-format |
| 2 | +# @brief clang-format configuration |
| 3 | +# |
| 4 | +# MIT License |
| 5 | +# |
| 6 | +# Copyright (c) 2022-2023 joelguittet and mender-mcu-client contributors |
| 7 | +# |
| 8 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | +# of this software and associated documentation files (the "Software"), to deal |
| 10 | +# in the Software without restriction, including without limitation the rights |
| 11 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | +# copies of the Software, and to permit persons to whom the Software is |
| 13 | +# furnished to do so, subject to the following conditions: |
| 14 | +# |
| 15 | +# The above copyright notice and this permission notice shall be included in all |
| 16 | +# copies or substantial portions of the Software. |
| 17 | +# |
| 18 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | +# SOFTWARE. |
| 25 | + |
| 26 | +# |
| 27 | +# This file is based on BARR-C 2018 format from https://github.com/petertorelli/clang-format-barr-c |
| 28 | +# Several modifications are done (braces positions and line width mainly) |
| 29 | +# |
| 30 | + |
| 31 | +--- |
| 32 | +Language: Cpp |
| 33 | +AccessModifierOffset: -4 |
| 34 | +AlignAfterOpenBracket: Align |
| 35 | +AlignConsecutiveMacros: true |
| 36 | +AlignConsecutiveAssignments: true |
| 37 | +AlignConsecutiveDeclarations: true |
| 38 | +AlignEscapedNewlines: Left |
| 39 | +AlignOperands: true |
| 40 | +AlignTrailingComments: true |
| 41 | +AllowAllArgumentsOnNextLine: true |
| 42 | +AllowAllConstructorInitializersOnNextLine: true |
| 43 | +AllowAllParametersOfDeclarationOnNextLine: true |
| 44 | +AllowShortBlocksOnASingleLine: Never |
| 45 | +AllowShortCaseLabelsOnASingleLine: false |
| 46 | +AllowShortFunctionsOnASingleLine: None |
| 47 | +AllowShortLambdasOnASingleLine: All |
| 48 | +AllowShortIfStatementsOnASingleLine: Never |
| 49 | +AllowShortLoopsOnASingleLine: false |
| 50 | +AlwaysBreakAfterDefinitionReturnType: TopLevel |
| 51 | +AlwaysBreakAfterReturnType: TopLevelDefinitions |
| 52 | +AlwaysBreakBeforeMultilineStrings: true |
| 53 | +AlwaysBreakTemplateDeclarations: Yes |
| 54 | +BinPackArguments: false |
| 55 | +BinPackParameters: false |
| 56 | +BraceWrapping: |
| 57 | + AfterCaseLabel: false |
| 58 | + AfterClass: false |
| 59 | + AfterControlStatement: false |
| 60 | + AfterEnum: false |
| 61 | + AfterFunction: false |
| 62 | + AfterNamespace: false |
| 63 | + AfterObjCDeclaration: false |
| 64 | + AfterStruct: false |
| 65 | + AfterUnion: false |
| 66 | + AfterExternBlock: false |
| 67 | + BeforeCatch: false |
| 68 | + BeforeElse: false |
| 69 | + IndentBraces: false |
| 70 | + SplitEmptyFunction: false |
| 71 | + SplitEmptyRecord: false |
| 72 | + SplitEmptyNamespace: false |
| 73 | +BreakBeforeBinaryOperators: All |
| 74 | +BreakBeforeBraces: Custom |
| 75 | +BreakBeforeInheritanceComma: false |
| 76 | +BreakInheritanceList: BeforeComma |
| 77 | +BreakBeforeTernaryOperators: true |
| 78 | +BreakConstructorInitializersBeforeComma: false |
| 79 | +BreakConstructorInitializers: BeforeComma |
| 80 | +BreakAfterJavaFieldAnnotations: true |
| 81 | +BreakStringLiterals: true |
| 82 | +ColumnLimit: 160 |
| 83 | +CommentPragmas: '^ IWYU pragma:' |
| 84 | +CompactNamespaces: false |
| 85 | +ConstructorInitializerAllOnOneLineOrOnePerLine: false |
| 86 | +ConstructorInitializerIndentWidth: 4 |
| 87 | +ContinuationIndentWidth: 4 |
| 88 | +Cpp11BracedListStyle: false |
| 89 | +DeriveLineEnding: true |
| 90 | +DerivePointerAlignment: false |
| 91 | +DisableFormat: false |
| 92 | +ExperimentalAutoDetectBinPacking: false |
| 93 | +FixNamespaceComments: false |
| 94 | +ForEachMacros: |
| 95 | + - foreach |
| 96 | + - Q_FOREACH |
| 97 | + - BOOST_FOREACH |
| 98 | +IncludeBlocks: Preserve |
| 99 | +IncludeCategories: |
| 100 | + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' |
| 101 | + Priority: 2 |
| 102 | + SortPriority: 0 |
| 103 | + - Regex: '^(<|"(gtest|gmock|isl|json)/)' |
| 104 | + Priority: 3 |
| 105 | + SortPriority: 0 |
| 106 | + - Regex: '.*' |
| 107 | + Priority: 1 |
| 108 | + SortPriority: 0 |
| 109 | +IncludeIsMainRegex: '(Test)?$' |
| 110 | +IncludeIsMainSourceRegex: '' |
| 111 | +IndentCaseLabels: true |
| 112 | +IndentGotoLabels: true |
| 113 | +IndentPPDirectives: None |
| 114 | +IndentWidth: 4 |
| 115 | +IndentWrappedFunctionNames: false |
| 116 | +JavaScriptQuotes: Leave |
| 117 | +JavaScriptWrapImports: true |
| 118 | +KeepEmptyLinesAtTheStartOfBlocks: true |
| 119 | +MacroBlockBegin: '' |
| 120 | +MacroBlockEnd: '' |
| 121 | +MaxEmptyLinesToKeep: 1 |
| 122 | +NamespaceIndentation: None |
| 123 | +ObjCBinPackProtocolList: Auto |
| 124 | +ObjCBlockIndentWidth: 4 |
| 125 | +ObjCSpaceAfterProperty: true |
| 126 | +ObjCSpaceBeforeProtocolList: false |
| 127 | +PenaltyBreakAssignment: 2 |
| 128 | +PenaltyBreakBeforeFirstCallParameter: 19 |
| 129 | +PenaltyBreakComment: 300 |
| 130 | +PenaltyBreakFirstLessLess: 120 |
| 131 | +PenaltyBreakString: 1000 |
| 132 | +PenaltyBreakTemplateDeclaration: 10 |
| 133 | +PenaltyExcessCharacter: 1000000 |
| 134 | +PenaltyReturnTypeOnItsOwnLine: 200 |
| 135 | +PointerAlignment: Right |
| 136 | +ReflowComments: false |
| 137 | +SortIncludes: false |
| 138 | +SortUsingDeclarations: false |
| 139 | +SpaceAfterCStyleCast: false |
| 140 | +SpaceAfterLogicalNot: false |
| 141 | +SpaceAfterTemplateKeyword: false |
| 142 | +SpaceBeforeAssignmentOperators: true |
| 143 | +SpaceBeforeCpp11BracedList: true |
| 144 | +SpaceBeforeCtorInitializerColon: true |
| 145 | +SpaceBeforeInheritanceColon: true |
| 146 | +SpaceBeforeParens: ControlStatements |
| 147 | +SpaceBeforeRangeBasedForLoopColon: true |
| 148 | +SpaceInEmptyBlock: false |
| 149 | +SpaceInEmptyParentheses: false |
| 150 | +SpacesBeforeTrailingComments: 1 |
| 151 | +SpacesInAngles: false |
| 152 | +SpacesInConditionalStatement: false |
| 153 | +SpacesInContainerLiterals: false |
| 154 | +SpacesInCStyleCastParentheses: false |
| 155 | +SpacesInParentheses: false |
| 156 | +SpacesInSquareBrackets: false |
| 157 | +SpaceBeforeSquareBrackets: false |
| 158 | +Standard: Latest |
| 159 | +StatementMacros: |
| 160 | + - Q_UNUSED |
| 161 | + - QT_REQUIRE_VERSION |
| 162 | +TabWidth: 8 |
| 163 | +UseCRLF: false |
| 164 | +UseTab: Never |
| 165 | +... |
| 166 | + |
0 commit comments