-
Notifications
You must be signed in to change notification settings - Fork 47
/
.clang-format
103 lines (87 loc) · 2.45 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
##
## Roughly follows the Linux Kernel coding guidelines, interpreting them for C++
##
## https://www.kernel.org/doc/html/latest/process/coding-style.html
##
{
"Language": "Cpp",
"Standard": "c++17",
# The LLVM style comes pretty close to what we want by default
"BasedOnStyle": "LLVM",
# Sync this with .editorconfig
"UseTab": "AlignWithSpaces",
"ColumnLimit": 100,
# Assume that one TAB character is 8 spaces wide
# This is required for calculating whether a line is wider than the limit defined above
"TabWidth": 8,
# Setup indentation using one TAB character
# This needs to be synced with the value of TabWidth
"IndentWidth": 8,
"AccessModifierOffset": -8,
"ContinuationIndentWidth": 8,
"ConstructorInitializerIndentWidth": 8,
# Put braces on the same line for every statement except for functions
"BreakBeforeBraces": "WebKit",
# Disable bin-packing.
# This means that the code will either be aligned horizontally or vertically, but not both.
"BinPackArguments": false,
"BinPackParameters": false,
"PackConstructorInitializers": "CurrentLine",
# Disable rules that might override the ones above to keep things consistent
"AllowAllArgumentsOnNextLine": false,
"AllowAllParametersOfDeclarationOnNextLine": false,
# Foo {bar} instead of Foo{ bar }
"SpaceBeforeCpp11BracedList": true,
"SpacesInContainerLiterals": false,
"KeepEmptyLinesAtTheStartOfBlocks": false,
# Make goto labels stand out
"IndentGotoLabels": false,
# template <class T>
# class Foo {};
#
# instead of
#
# template <class T> class Foo {};
"AlwaysBreakTemplateDeclarations": true,
# void foo()
# {
# }
#
# instead of
#
# void foo() {}
"AllowShortFunctionsOnASingleLine": "None",
# Automatically format comments, includes and using statements
"IncludeBlocks": "Regroup",
"ReflowComments": true,
"SortIncludes": "CaseSensitive",
"SortUsingDeclarations": true,
"IncludeCategories": [
{
# Includes relative to the file use #include "..."
"Regex": "^\".+\"$",
"Priority": 1,
},
{
# All directories under src/
"Regex": "^<(common|contacts|core|hid|ipts)/.+>$",
"Priority": 2,
},
{
# Dependencies
"Regex": "^<(gsl|Eigen|spdlog|fmt|cairomm|CLI)/.+>$",
"Priority": 3,
},
{
# Dependencies with only a single header
"Regex": "^<(INIReader.h|SDL.h)>$",
"Priority": 3,
},
{
# Linux userspace API
"Regex": "^<(linux|sys)/.+>$",
"Priority": 4,
},
# The C / C++ standard library is automatically assigned priority 5
],
}