-
Notifications
You must be signed in to change notification settings - Fork 5
/
.clang-format
65 lines (52 loc) · 1.76 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
Language: Cpp
# to apply these settings on git commit on changed lines only, the easiest way
# is to use pre-commit; read .pre-commit-config.yaml for details.
#
# Another way is this pre-commit hook:
# https://github.com/barisione/clang-format-hooks
# clone it somewhere, run '/path/to/clone/git-pre-commit-format install'
# test diff with
# git checkout src; find . -iname '*.h' -o -iname '*.cpp' | parallel clang-format -i; git diff src | wc -l
# diff count: 118038
# closest to our legacy style...
BasedOnStyle: Microsoft
IndentWidth: 4
AccessModifierOffset: -4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Allman
# diff count trunk
# none : 189776
# Attach : 203028
# Linux : 198465
# Mozilla : 203028
# Stroustrup: 198585 (Also WebKit)
# Allman : 189711 <-
# Whitesmiths:234458
# GNU : 231651
#
# leave line breaks alone
ColumnLimit: 0
# note: it is still recommended to leave lines short, ideally below 80; but
# letting clang-format handle that does not work well enough and one needs
# to use tricks, like empty trailing comments.
# do not mess with includes
SortIncludes: false
# the code has them more often than not, and this follows the astyle config
# f( x ) instead of f(x)
# SpacesInParentheses: true
# But, I (Z-Man) don't like it any more. It does not improve readability.
# Might be my eyes, though.
# we have more "int* x" than "int *x" (or "int * x")
PointerAlignment: Left
AllowShortFunctionsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
# Alignment options
# leave to individual choice for now
# AlignAfterOpenBracket: AlwaysBreak
#AlignConsecutiveMacros: false
#AlignConsecutiveAssignments: false
#AlignConsecutiveDeclarations: false
#AlignOperands: false
#AlignTrailingComments: true
#AllowAllConstructorInitializersOnNextLine: true