-
Notifications
You must be signed in to change notification settings - Fork 16
/
.clang-format
160 lines (138 loc) · 3.36 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
---
Language: Cpp
# We want to format the 'public' keyword as follows:
#
# class Foo
# {
# public: // <- indentation style of 'public' keyword
# Foo() = default;
# };
AccessModifierOffset: -2
# TODO: understand what these means.
AlignAfterOpenBracket: Align
AlignEscapedNewlinesLeft: Right
# We want:
#
# int aaa = bbbbbbbbbbbbbbb +
# ccccccccccccccc;
AlignOperands: true
# We want aligned trailing comments, e.g.:
# void someFunction()
# {
# doWork(); // Does something
# doMoreWork(); // Does something else
# } // ^
# // |
# // |----- aligned trailing comments
AlignTrailingComments: true
# We want to allow declaring functions as follows:
#
# someFunction(foo,
# bar,
# baz);
AllowAllParametersOfDeclarationOnNextLine: true
# Don't allow:
# if (a) { return; }
#
# We want:
#
# if (a)
# return;
AllowShortBlocksOnASingleLine: false
# Pretty clear.
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlwaysBreakTemplateDeclarations: true
# true: false:
# aaaa = vs. aaaa = "bbbb"
# "bbbb" "cccc";
# "cccc";
#
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
BinPackArguments: true
# Line size.
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
# We want to allow 2 empty lines in order to organize the code as follows:
#
# #include <vector>
#
# #include <boost/python.hpp>
#
# #include <DO/Sara/Core.hpp>
#
#
# using namespace std;
# using namespace DO::Sara;
#
#
# int main()
# {
# return 0;
# }
MaxEmptyLinesToKeep: 2
KeepEmptyLinesAtTheStartOfBlocks: true
CompactNamespaces: true
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 2
TabWidth: 2
UseTab: Never
# BreakBeforeBraces: 'Allman'
BreakBeforeBraces: 'Custom'
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterObjCDeclaration: true
AfterStruct: true
BeforeCatch: true
BeforeElse: true
# Pretty clear
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
# We want:
# (int *) data;
# Not:
# (int *)data;
# ( int* ) data;
# ( int * ) data;
# and so on.
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: true
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...