forked from precice/openfoam-adapter
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.clang-format
175 lines (174 loc) · 5.91 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
Language: Cpp
# BasedOnStyle: LLVM
#
# Proposed clang-format-11 style for OpenFOAM, trying to follow the OpenFOAM style guide:
# https://develop.openfoam.com/Development/openfoam/-/wikis/coding/style/style
# Configuration developed for the OpenFOAM-preCICE adapter code:
# https://github.com/precice/openfoam-adapter
# Contribute to the discussion at the respective OpenFOAM issue:
# https://develop.openfoam.com/Development/openfoam/-/issues/1634
#
# Keep `public:` at the first indentation level
AccessModifierOffset: -4
# Undocumented guideline: align arguments after an open bracket.
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
# Align operands after operators (+,*,<<) (see BreakBeforeBinaryOperators)
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: false
# Guideline: Splitting return type and function name
# (this guideline is apparently not strictly followed in OpenFOAM)
# AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
# Covered by "BreakBeforeBraces"
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# Guideline (almost): Splitting long lines at an = sign. Indent after split.
# Guideline (almost): Splitting formulae over several lines.
BreakBeforeBinaryOperators: NonAssignment
# Always break before braces: if, for, functions, classes, etc.
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
# Guideline (almost): Splitting logical tests over several lines.
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
# Undocumented guideline (almost): Have the initializer : in a new line.
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
# Here we could set the 80 charactes limit, but that would lead to more aggressive changes.
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 0
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
# Undocumented guideline: add line after "public:" etc (since clang-format 12)
# EmptyLineAfterAccessModifier: Always
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
# Guideline: Macro loops are like for loops, but without a space.
ForEachMacros:
- forAllIters
- forAllConstIters
- forAllReverseIters
- forAllConstReverseIters
- forAll
- forAllReverse
- forAllIter
- forAllConstIter
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
# Guideline: The normal indentation is 4 spaces per logical level.
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
# Required to not change code following the guidelines
# "Leave two empty lines between sections" and
# "Use two empty lines between functions"
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
# Do not change the order of include statements (could be catastrophic for OpenFOAM)
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
# No "template <T>" (guideline already used, but not documented)
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
# No a{1} (no guideline)
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
# Guideline: Spaces in "if ()", "for ()", but not "forAll ()".
SpaceBeforeParens: ControlStatementsExceptForEachMacros
# Guideline: Range-based for should have a space surrounding the ':'.
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
# No "arr[3] = [ 1, 2, 3 ]" (no guideline).
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
# Treat the code as C++11 or later
Standard: Latest
StatementMacros:
TabWidth: 4
UseCRLF: false
# Guideline: No tab characters - only use spaces for indentation.
UseTab: Never
WhitespaceSensitiveMacros:
...