|
1 |
| ---- |
2 |
| -Language: Cpp |
3 |
| -AccessModifierOffset: -3 |
4 |
| -AlignAfterOpenBracket: Align |
5 |
| -AlignConsecutiveMacros: true |
6 |
| -AlignConsecutiveAssignments: false |
7 |
| -AlignConsecutiveDeclarations: false |
8 |
| -AlignEscapedNewlines: Left |
9 |
| -AlignOperands: true |
10 |
| -AlignTrailingComments: true |
11 |
| -AllowAllArgumentsOnNextLine: true |
12 |
| -AllowAllConstructorInitializersOnNextLine: true |
13 |
| -AllowAllParametersOfDeclarationOnNextLine: true |
14 |
| -AllowShortBlocksOnASingleLine: Never |
15 |
| -AllowShortCaseLabelsOnASingleLine: false |
16 |
| -AllowShortFunctionsOnASingleLine: All |
17 |
| -AllowShortLambdasOnASingleLine: All |
18 |
| -AllowShortIfStatementsOnASingleLine: Never |
19 |
| -AllowShortLoopsOnASingleLine: true |
20 |
| -AlwaysBreakAfterDefinitionReturnType: None |
21 |
| -AlwaysBreakAfterReturnType: None |
22 |
| -AlwaysBreakBeforeMultilineStrings: true |
23 |
| -AlwaysBreakTemplateDeclarations: Yes |
24 |
| -BinPackArguments: true |
25 |
| -BinPackParameters: true |
| 1 | +# .clang-format |
| 2 | +BasedOnStyle: Google # Use Google C++ style guide as the base |
| 3 | +IndentWidth: 4 # Set the number of spaces per indentation level |
| 4 | +TabWidth: 4 # Define tab width |
| 5 | +UseTab: Never # Always use spaces instead of tabs |
| 6 | +ColumnLimit: 100 # Maximum characters per line |
| 7 | +AllowShortIfStatementsOnASingleLine: false # Always put 'if' statements on separate lines |
| 8 | +AllowShortFunctionsOnASingleLine: InlineOnly # Only inline short functions on a single line |
| 9 | +BreakBeforeBraces: Allman # Use Allman style for braces (open braces on a new line) |
| 10 | +SpaceBeforeParens: ControlStatements # Add space before parentheses in control statements |
| 11 | +AlignConsecutiveAssignments: true # Align variable assignments for readability |
| 12 | +AlignConsecutiveDeclarations: true # Align declarations for consistency |
| 13 | +SortIncludes: true # Sort `#include` statements |
| 14 | +PointerAlignment: Left # Place the '*' next to the type (e.g., `int* ptr` instead of `int *ptr`) |
| 15 | +Standard: Cpp11 # Use C++11 as the standard |
| 16 | + |
| 17 | +# Customize comments styling |
| 18 | +CommentPragmas: '^ IWYU pragma:' # Ignore 'Include What You Use' pragmas |
| 19 | + |
| 20 | +# Customize brace wrapping |
26 | 21 | BraceWrapping:
|
27 |
| - AfterCaseLabel: false |
28 |
| - AfterClass: false |
29 |
| - AfterControlStatement: false |
30 |
| - AfterEnum: false |
31 |
| - AfterFunction: false |
32 |
| - AfterNamespace: false |
33 |
| - AfterObjCDeclaration: false |
34 |
| - AfterStruct: false |
35 |
| - AfterUnion: false |
36 |
| - AfterExternBlock: false |
37 |
| - BeforeCatch: false |
38 |
| - BeforeElse: false |
39 |
| - IndentBraces: false |
| 22 | + AfterClass: true |
| 23 | + AfterControlStatement: true |
| 24 | + AfterEnum: true |
| 25 | + AfterFunction: true |
| 26 | + AfterNamespace: true |
| 27 | + AfterStruct: true |
40 | 28 | SplitEmptyFunction: true
|
41 | 29 | SplitEmptyRecord: true
|
42 | 30 | SplitEmptyNamespace: true
|
43 |
| -BreakBeforeBinaryOperators: None |
44 |
| -BreakBeforeBraces: Attach |
45 |
| -BreakBeforeInheritanceComma: false |
46 |
| -BreakInheritanceList: BeforeColon |
47 |
| -BreakBeforeTernaryOperators: true |
48 |
| -BreakConstructorInitializersBeforeComma: false |
49 |
| -BreakConstructorInitializers: BeforeColon |
50 |
| -BreakAfterJavaFieldAnnotations: false |
51 |
| -BreakStringLiterals: true |
52 |
| -ColumnLimit: 80 |
53 |
| -CommentPragmas: '^ IWYU pragma:' |
54 |
| -CompactNamespaces: false |
55 |
| -ConstructorInitializerAllOnOneLineOrOnePerLine: true |
| 31 | + |
| 32 | +# Make constructor initializer lists more readable |
56 | 33 | ConstructorInitializerIndentWidth: 4
|
57 |
| -ContinuationIndentWidth: 4 |
58 |
| -Cpp11BracedListStyle: true |
59 |
| -DeriveLineEnding: true |
60 |
| -DerivePointerAlignment: true |
61 |
| -DisableFormat: false |
62 |
| -ExperimentalAutoDetectBinPacking: false |
63 |
| -FixNamespaceComments: true |
64 |
| -ForEachMacros: |
65 |
| - - foreach |
66 |
| - - Q_FOREACH |
67 |
| - - BOOST_FOREACH |
68 |
| -IncludeBlocks: Regroup |
69 |
| -IncludeCategories: |
70 |
| - - Regex: '^<ext/.*\.h>' |
71 |
| - Priority: 2 |
72 |
| - SortPriority: 0 |
73 |
| - - Regex: '^<.*\.h>' |
74 |
| - Priority: 1 |
75 |
| - SortPriority: 0 |
76 |
| - - Regex: '^<.*' |
77 |
| - Priority: 2 |
78 |
| - SortPriority: 0 |
79 |
| - - Regex: '.*' |
80 |
| - Priority: 3 |
81 |
| - SortPriority: 0 |
82 |
| -IncludeIsMainRegex: '([-_](test|unittest))?$' |
83 |
| -IncludeIsMainSourceRegex: '' |
84 |
| -IndentCaseLabels: true |
85 |
| -IndentGotoLabels: true |
86 |
| -IndentPPDirectives: None |
87 |
| -IndentWidth: 4 |
88 |
| -IndentWrappedFunctionNames: false |
89 |
| -JavaScriptQuotes: Leave |
90 |
| -JavaScriptWrapImports: true |
91 |
| -KeepEmptyLinesAtTheStartOfBlocks: false |
92 |
| -MacroBlockBegin: '' |
93 |
| -MacroBlockEnd: '' |
94 |
| -MaxEmptyLinesToKeep: 1 |
95 |
| -NamespaceIndentation: None |
96 |
| -ObjCBinPackProtocolList: Never |
97 |
| -ObjCBlockIndentWidth: 2 |
98 |
| -ObjCSpaceAfterProperty: false |
99 |
| -ObjCSpaceBeforeProtocolList: true |
100 |
| -PenaltyBreakAssignment: 2 |
101 |
| -PenaltyBreakBeforeFirstCallParameter: 1 |
102 |
| -PenaltyBreakComment: 300 |
103 |
| -PenaltyBreakFirstLessLess: 120 |
104 |
| -PenaltyBreakString: 1000 |
105 |
| -PenaltyBreakTemplateDeclaration: 10 |
106 |
| -PenaltyExcessCharacter: 1000000 |
107 |
| -PenaltyReturnTypeOnItsOwnLine: 200 |
108 |
| -PointerAlignment: Left |
109 |
| -RawStringFormats: |
110 |
| - - Language: Cpp |
111 |
| - Delimiters: |
112 |
| - - cc |
113 |
| - - CC |
114 |
| - - cpp |
115 |
| - - Cpp |
116 |
| - - CPP |
117 |
| - - 'c++' |
118 |
| - - 'C++' |
119 |
| - CanonicalDelimiter: '' |
120 |
| - BasedOnStyle: google |
121 |
| - - Language: TextProto |
122 |
| - Delimiters: |
123 |
| - - pb |
124 |
| - - PB |
125 |
| - - proto |
126 |
| - - PROTO |
127 |
| - EnclosingFunctions: |
128 |
| - - EqualsProto |
129 |
| - - EquivToProto |
130 |
| - - PARSE_PARTIAL_TEXT_PROTO |
131 |
| - - PARSE_TEST_PROTO |
132 |
| - - PARSE_TEXT_PROTO |
133 |
| - - ParseTextOrDie |
134 |
| - - ParseTextProtoOrDie |
135 |
| - CanonicalDelimiter: '' |
136 |
| - BasedOnStyle: google |
137 |
| -ReflowComments: true |
138 |
| -SortIncludes: true |
139 |
| -SortUsingDeclarations: true |
140 |
| -SpaceAfterCStyleCast: false |
141 |
| -SpaceAfterLogicalNot: false |
142 |
| -SpaceAfterTemplateKeyword: true |
143 |
| -SpaceBeforeAssignmentOperators: true |
144 |
| -SpaceBeforeCpp11BracedList: false |
145 |
| -SpaceBeforeCtorInitializerColon: true |
146 |
| -SpaceBeforeInheritanceColon: true |
147 |
| -SpaceBeforeParens: ControlStatements |
148 |
| -SpaceBeforeRangeBasedForLoopColon: true |
149 |
| -SpaceInEmptyBlock: false |
150 |
| -SpaceInEmptyParentheses: false |
151 |
| -SpacesBeforeTrailingComments: 2 |
152 |
| -SpacesInAngles: false |
153 |
| -SpacesInConditionalStatement: false |
154 |
| -SpacesInContainerLiterals: true |
155 |
| -SpacesInCStyleCastParentheses: false |
156 |
| -SpacesInParentheses: false |
157 |
| -SpacesInSquareBrackets: false |
158 |
| -SpaceBeforeSquareBrackets: false |
159 |
| -Standard: Auto |
160 |
| -StatementMacros: |
161 |
| - - Q_UNUSED |
162 |
| - - QT_REQUIRE_VERSION |
163 |
| -TabWidth: 4 |
164 |
| -UseCRLF: false |
165 |
| -UseTab: Never |
166 |
| -... |
| 34 | +ConstructorInitializerAllOnOneLineOrOnePerLine: true |
| 35 | + |
| 36 | +# Format macros correctly |
| 37 | +AlwaysBreakBeforeMultilineStrings: true |
| 38 | +AllowAllArgumentsOnNextLine: true |
167 | 39 |
|
| 40 | +# Enable include sorting with quotation marks before angle brackets |
| 41 | +IncludeBlocks: Regroup |
| 42 | +IncludeIsMainRegex: '(Test)?$' |
| 43 | +IncludeCategories: |
| 44 | + - Regex: '^<.*\.h>' |
| 45 | + Priority: 1 |
| 46 | + - Regex: '^".*\.h"' |
| 47 | + Priority: 2 |
| 48 | + - Regex: '^<.*>' |
| 49 | + Priority: 3 |
| 50 | + - Regex: '^".*"' |
| 51 | + Priority: 4 |
0 commit comments