Skip to content

Commit 5efac93

Browse files
committed
add .clang-format
1 parent 53e8525 commit 5efac93

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

.clang-format

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
BasedOnStyle: Google
3+
IndentWidth: '4'
4+
ColumnLimit: '120'
5+
6+
IncludeCategories:
7+
# main include automatically assigned to Priority 0
8+
- Regex: '^".*_(conf|config)\.(hpp|h)"$' # config headers
9+
Priority: 3
10+
- Regex: '^".*"$' # sibling & project headers
11+
Priority: 1
12+
- Regex: '^<.*>$' # system & library headers
13+
Priority: 2
14+
15+
# Format function arguments and parameters
16+
BinPackArguments: 'false'
17+
BinPackParameters: 'false'
18+
AllowAllArgumentsOnNextLine: 'false'
19+
AllowAllParametersOfDeclarationOnNextLine: 'false'
20+
AlignAfterOpenBracket: BlockIndent
21+
SpaceBeforeParens: ControlStatements
22+
23+
# Constructor Formatting
24+
PackConstructorInitializers: CurrentLine
25+
IndentAccessModifiers: 'false'
26+
AccessModifierOffset: '-4'
27+
SpaceBeforeCtorInitializerColon: 'true'
28+
BreakConstructorInitializers: BeforeColon
29+
LambdaBodyIndentation: OuterScope
30+
31+
AllowShortCaseLabelsOnASingleLine: 'true'
32+
AllowShortBlocksOnASingleLine: 'false'
33+
AllowShortIfStatementsOnASingleLine: Never
34+
AllowShortLoopsOnASingleLine: 'false'
35+
AllowShortEnumsOnASingleLine: 'true'
36+
AllowShortFunctionsOnASingleLine: 'Inline'
37+
AllowShortLambdasOnASingleLine: 'All'
38+
39+
# Switch / Case
40+
IndentCaseLabels: 'true'
41+
IndentCaseBlocks: 'false'
42+
43+
# Preprocessor stuff
44+
AlignConsecutiveMacros: 'false'
45+
AlignEscapedNewlines: DontAlign
46+
AlignTrailingComments: 'false'
47+
SpacesBeforeTrailingComments: 1
48+
49+
# Alignment of procedural code
50+
AlignConsecutiveAssignments: 'false'
51+
AlignConsecutiveDeclarations: 'false'
52+
AlignConsecutiveBitFields: Consecutive
53+
54+
AlignOperands: AlignAfterOperator
55+
# BreakBeforeTernaryOperators: 'false'
56+
BreakBeforeBinaryOperators: 'true'
57+
58+
# Pointers and East/West Const
59+
DerivePointerAlignment: 'false'
60+
PointerAlignment: Left
61+
QualifierAlignment: Leave
62+
# QualifierOrder: ['volatile', 'constexpr', 'static', 'inline', 'type', 'const']
63+
64+
Cpp11BracedListStyle: 'true'
65+
66+
# Vertical Whitespace
67+
SeparateDefinitionBlocks: Leave
68+
EmptyLineBeforeAccessModifier: Always
69+
EmptyLineAfterAccessModifier: Never
70+
71+
# AlignArrayOfStructures: Right
72+
# InsertTrailingCommas: 'Wrapped'
73+
74+
75+
AlwaysBreakAfterReturnType: None
76+
PenaltyReturnTypeOnItsOwnLine: 9999 # We really hate breaking after return types
77+
PenaltyBreakAssignment: 999 # Prefer not to break around =
78+
79+
SpaceAfterTemplateKeyword: 'false'
80+
81+
MaxEmptyLinesToKeep: 2
82+
83+
FixNamespaceComments: 'true'
84+
#IndentPPDirectives: BeforeHash
85+
# NamespaceIndentation: All
86+
...

0 commit comments

Comments
 (0)