-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.clang-format
More file actions
80 lines (73 loc) · 2.77 KB
/
Copy path.clang-format
File metadata and controls
80 lines (73 loc) · 2.77 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
---
Language: Cpp
BasedOnStyle: Microsoft
# Indentation
IndentWidth: 2 # 2 spaces per indent
AccessModifierOffset: -2
IndentAccessModifiers: false # Align access modifiers to braces
NamespaceIndentation: All # Indent namspace contents
ConstructorInitializerIndentWidth: 2
# Comments which match this regex will be unformatted (and therefore can be longer or have more whitespace than other comments)
CommentPragmas: '^\*\*'
# Alignment
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
# For future versions of clang-format
# AlignFunctionDeclarations: false
# AlignFunctionPointers: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
# Newlines
ColumnLimit: 0
BreakBeforeBraces: Allman # Braces on their own lines
SeparateDefinitionBlocks: Always # Separate definitions (functions etc.) with an empty line
AlwaysBreakTemplateDeclarations: true # Put template on their own lines
AllowShortBlocksOnASingleLine: Never
# On a newer version of clang-format, replace with BinPackArguments: OnePerLine
BinPackArguments: false # Don't allow multiple function arguments on the same line unless they all fit
BinPackParameters: false # Same but for parameters
PackConstructorInitializers: NextLine
AllowShortFunctionsOnASingleLine: None
BreakBeforeBinaryOperators: NonAssignment # Put binary operators after a line break, rather than before
AllowShortIfStatementsOnASingleLine: Never
# Spaces
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceAfterCStyleCast: true
PointerAlignment: Left
# Includes
IncludeBlocks: Regroup # Regroup includes based on config
IncludeCategories:
- Regex: '^"[^/]+\.h"' # 'local' includes
Priority: 5
- Regex: '^<GridKit\/' # Public project includes
Priority: 4
CaseSensitive: true
- Regex: '^<(nlohmann|magic_enum)' # Library includes
Priority: 3
CaseSensitive: true
- Regex: '^<(idas|sun|kinsol|nvector)' # Library includes
Priority: 3
CaseSensitive: true
- Regex: '^<(Ip[A-Za-z_]+\.hpp)' # Ipopt includes
Priority: 3
CaseSensitive: true
- Regex: '^<[a-z_]+>' # STL includes
Priority: 2
CaseSensitive: true
- Regex: '^<[a-z_]+\.h>' # C standard headers
Priority: 1
CaseSensitive: true