.clang-format (6297B)
1 ---
2 Language: Cpp
3 AccessModifierOffset: -2 # consistent with case labels
4 AlignAfterOpenBracket: Align # one param per line, looks bad for auto fn() -> TYPE {} though.
5 AlignConsecutiveMacros: false #
6 AlignConsecutiveAssignments: false #
7 AlignConsecutiveBitFields: false #
8 AlignConsecutiveDeclarations: false #
9 AlignEscapedNewlines: Right #
10 AlignOperands: AlignAfterOperator # looks better and saves space
11 AlignTrailingComments: false #
12 AllowAllArgumentsOnNextLine: false # one per line
13 AllowAllConstructorInitializersOnNextLine: false # one per line
14 AllowAllParametersOfDeclarationOnNextLine: false # one per line
15 AllowShortEnumsOnASingleLine: false # one per line
16 AllowShortBlocksOnASingleLine: Empty # minimize diff
17 AllowShortCaseLabelsOnASingleLine: false # one per line
18 AllowShortFunctionsOnASingleLine: Empty #
19 AllowShortLambdasOnASingleLine: All #
20 AllowShortIfStatementsOnASingleLine: Never # always have braces
21 AllowShortLoopsOnASingleLine: false #
22 AlwaysBreakAfterReturnType: None #
23 AlwaysBreakBeforeMultilineStrings: false #
24 AlwaysBreakTemplateDeclarations: Yes #
25 BinPackArguments: false # one per line
26 BinPackParameters: false # one per line
27 BreakBeforeBraces: Attach #
28 BraceWrapping: # not in effect
29 AfterCaseLabel: false
30 AfterClass: false
31 AfterControlStatement: Never
32 AfterEnum: false
33 AfterFunction: false
34 AfterNamespace: false
35 AfterObjCDeclaration: false
36 AfterStruct: false
37 AfterUnion: false
38 AfterExternBlock: false
39 BeforeCatch: false
40 BeforeElse: false
41 BeforeLambdaBody: false
42 BeforeWhile: false
43 IndentBraces: false
44 SplitEmptyFunction: true
45 SplitEmptyRecord: true
46 SplitEmptyNamespace: true
47 BreakBeforeBinaryOperators: NonAssignment # so that = and {} init look the same when split
48 BreakInheritanceList: AfterColon # less indention, look distinct from both labels and tenrary
49 BreakBeforeTernaryOperators: true #
50 BreakConstructorInitializers: AfterColon # less indention, look distinct from both labels and tenrary
51 BreakStringLiterals: false # makes searching hard
52 ColumnLimit: 80 # debatible, but should be plenty as we indent 2 spaces
53 CommentPragmas: '^ IWYU pragma:' # to be added
54 CompactNamespaces: false #
55 ConstructorInitializerAllOnOneLineOrOnePerLine: true # one per line
56 ConstructorInitializerIndentWidth: 2 #
57 ContinuationIndentWidth: 4 # differentiate parameter list from body
58 Cpp11BracedListStyle: true #
59 DeriveLineEnding: true #
60 DerivePointerAlignment: false #
61 DisableFormat: false #
62 ExperimentalAutoDetectBinPacking: false #? experimental
63 FixNamespaceComments: true #
64 ForEachMacros: #? TBD
65 - foreach
66 - Q_FOREACH
67 - BOOST_FOREACH
68 IncludeBlocks: Regroup #
69 IncludeCategories: #
70 # C stdlib headers
71 - Regex: '^<(assert\.h|complex\.h|ctype\.h|errno\.h|fenv\.h|float\.h|inttypes\.h|iso646\.h|limits\.h|locale\.h|math\.h|setjmp\.h|signal\.h|stdalign\.h|stdarg\.h|stdatomic\.h|stdbool\.h|stddef\.h|stdint\.h|stdio\.h|stdlib\.h|stdnoreturn\.h|string\.h|tgmath\.h|threads\.h|time\.h|uchar\.h|wchar\.h|wctype\.h)>'
72 Priority: 6
73 # C compatibility headers
74 - Regex: '^<(cassert|cctype|cerrno|cfenv|cfloat|cinttypes|climits|clocale|cmath|csetjmp|csignal|cstdarg|cstddef|cstdint|cstdio|cstdlib|cstring|ctime|cuchar|cwchar|cwctype)>$'
75 Priority: 5
76 # C++ stdlib headers
77 - Regex: '^<(algorithm|any|array|atomic|barrier|bit|bitset|charconv|chrono|codecvt|compare|complex|concepts|condition_variable|coroutine|deque|exception|execution|filesystem|format|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|latch|limits|list|locale|map|memory|memory_resource|mutex|new|numbers|numeric|optional|ostream|queue|random|ranges|ratio|regex|scoped_allocator|semaphore|set|shared_mutex|source_location|span|sstream|stack|stdexcept|stop_token|streambuf|string|string_view|strstream|syncstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector|version)>$'
78 Priority: 4
79 # Other system headers
80 - Regex: '^<.*>'
81 Priority: 3
82 # Project headers in other locations
83 - Regex: '^".*/.*"'
84 Priority: 2
85 # Project headers in the same location
86 - Regex: '^".*"'
87 Priority: 1
88 IncludeIsMainRegex: '(Test)?$' #? TBD
89 IncludeIsMainSourceRegex: '' #
90 IndentCaseLabels: false #
91 IndentCaseBlocks: false #
92 IndentGotoLabels: true #
93 IndentPPDirectives: AfterHash #
94 IndentExternBlock: Indent #? TBD
95 IndentWidth: 2 #
96 IndentWrappedFunctionNames: false #
97 # InsertTrailingCommas: Wrapped #? JavaScript
98 # JavaScriptQuotes: Leave #? JavaScript
99 # JavaScriptWrapImports: true #? JavaScript
100 KeepEmptyLinesAtTheStartOfBlocks: false #
101 MacroBlockBegin: '' #? TBD
102 MacroBlockEnd: '' #? TBD
103 MaxEmptyLinesToKeep: 1 #
104 NamespaceIndentation: None #
105 # ObjCBinPackProtocolList: Auto #? Objective C
106 # ObjCBlockIndentWidth: 2 #? Objective C
107 # ObjCBreakBeforeNestedBlockParam: true #? Objective C
108 # ObjCSpaceAfterProperty: false #? Objective C
109 # ObjCSpaceBeforeProtocolList: true #? Objective C
110 PenaltyBreakAssignment: 2 #?
111 PenaltyBreakBeforeFirstCallParameter: 19 #?
112 PenaltyBreakComment: 300 #?
113 PenaltyBreakFirstLessLess: 120 #?
114 PenaltyBreakString: 1000 #?
115 PenaltyBreakTemplateDeclaration: 10 #?
116 PenaltyExcessCharacter: 1000000 #?
117 PenaltyReturnTypeOnItsOwnLine: 60 #?
118 PointerAlignment: Left # separate type and identifier
119 ReflowComments: true #
120 SortIncludes: true #
121 SortUsingDeclarations: true #
122 SpaceAfterCStyleCast: true # like rust's "as"
123 SpaceAfterLogicalNot: false #
124 SpaceAfterTemplateKeyword: true #
125 SpaceBeforeAssignmentOperators: true #
126 SpaceBeforeCpp11BracedList: false # looks bad for empty init list
127 SpaceBeforeCtorInitializerColon: true #
128 SpaceBeforeInheritanceColon: true #
129 SpaceBeforeParens: ControlStatementsExceptForEachMacros #
130 SpaceBeforeRangeBasedForLoopColon: true #
131 SpaceInEmptyBlock: false #
132 SpaceInEmptyParentheses: false #
133 SpacesBeforeTrailingComments: 2 #
134 SpacesInAngles: false #
135 SpacesInConditionalStatement: false #
136 SpacesInContainerLiterals: true #
137 SpacesInCStyleCastParentheses: false #
138 SpacesInParentheses: false #
139 SpacesInSquareBrackets: false #
140 SpaceBeforeSquareBrackets: false #
141 Standard: Latest #
142 StatementMacros: #? TBD
143 - Q_UNUSED
144 - QT_REQUIRE_VERSION
145 TabWidth: 2 # same as indent
146 UseCRLF: false #
147 UseTab: Never #
148 WhitespaceSensitiveMacros: #? TBD
149 - STRINGIZE
150 - PP_STRINGIZE
151 - BOOST_PP_STRINGIZE
152 ...