-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.clang-format
More file actions
141 lines (127 loc) · 3.96 KB
/
.clang-format
File metadata and controls
141 lines (127 loc) · 3.96 KB
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
---
# Rust-style formatting for C++17 (ExaConstit)
Language: Cpp
Standard: c++17
# Line length matching rustfmt default
ColumnLimit: 100
# Indentation - Rust uses 4 spaces everywhere
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4
AccessModifierOffset: -4
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentExternBlock: NoIndent
IndentWrappedFunctionNames: false
# Braces - Rust style (same line for functions/structs)
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# Function and control flow formatting
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortLambdasOnASingleLine: Empty
# Alignment - keep things clean like Rust
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
# Pointer and reference alignment (Rust style: left-aligned with type)
PointerAlignment: Left
ReferenceAlignment: Left
DerivePointerAlignment: false
# Spacing
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
# Line breaking
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
# Bin packing and arguments
BinPackArguments: false
BinPackParameters: false
# Constructor initializer and inheritance
ConstructorInitializerIndentWidth: 4
CompactNamespaces: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
# Include sorting - ExaConstit headers first, then TPLs, then stdlib
# NOTE: clang-format will alphabetize within each priority group
SortIncludes: CaseSensitive
IncludeBlocks: Regroup
IncludeCategories:
# ExaConstit project headers (quoted includes from project directories)
- Regex: '^"(boundary_conditions|fem_operators|mfem_expt|models|options|postprocessing|sim_state|solvers|system_driver|umats|utilities)/'
Priority: 1
- Regex: '^"(system_driver)'
Priority: 1
# Third-party library headers (RAJA, mfem, ecmech, snls, caliper)
- Regex: '^"(RAJA|mfem|ecmech|snls|caliper)'
Priority: 2
# Standard C++ library (angle brackets, no file extension)
- Regex: '^<[a-z_]+>$'
Priority: 3
# C standard library (angle brackets with .h extension)
- Regex: '^<[a-z_]+\.h>$'
Priority: 3
# Catch-all for anything else
- Regex: '.*'
Priority: 99
# Namespace formatting
NamespaceIndentation: None
FixNamespaceComments: true
# Penalties (for breaking decisions)
PenaltyBreakAssignment: 100
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
# Misc
ReflowComments: true
SortUsingDeclarations: true