Debian Codegraph @

.clang-format

raw
1 # Copyright (C) 2022 The Qt Company Ltd.
2 # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 # Evaluate features before including repository subparts.
4
5 ---
6 # Use the new standard
7 Standard: c++20
8
9 # Webkit style was loosely based on the Qt style
10 BasedOnStyle: WebKit
11
12 # Column width is limited to 100 in accordance with Qt Coding Style.
13 # https://wiki.qt.io/Qt_Coding_Style
14 # Note that this may be changed at some point in the future.
15 ColumnLimit: 100
16
17 # We want a space between the type and the star for pointer types.
18 PointerBindsToType: false
19
20 # We want to break before the operators, but not before a '='.
21 BreakBeforeBinaryOperators: NonAssignment
22
23 PointerAlignment: Right
24 AllowShortEnumsOnASingleLine: true
25 # Allow indentation for preprocessing directives (if/ifdef/endif). https://reviews.llvm.org/rL312125
26 IndentPPDirectives: AfterHash
27 # We only indent with 2 spaces for preprocessor directives
28 PPIndentWidth: 2
29
30 # REUSE-IgnoreStart
31 # Do not format copyright comment lines and qtdoc lines
32 CommentPragmas: "^ SPDX-License-Identifier:|^ Copyright|\\since|\\overload|\\reentrant|\\value|\\li|\\l"
33 # REUSE-IgnoreEnd
34
35 # macros for which the opening brace stays attached.
36 ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
37
38 # In QtBase/QtGRPC we use template < with space
39 SpaceAfterTemplateKeyword: true
40
41 # Break constructor initializers before the colon and after the commas.
42 BreakConstructorInitializers: BeforeColon
43
44 # Add "// namespace <namespace>" comments on closing brace for a namespace
45 # Ignored for namespaces that qualify as a short namespace,
46 # see 'ShortNamespaceLines'
47 FixNamespaceComments: true
48
49 # When constructor initializers do not fit on one line, put them each on a new line.
50 ConstructorInitializerAllOnOneLineOrOnePerLine: false
51 # Indent initializers by 4 spaces
52 ConstructorInitializerIndentWidth: 4
53
54 # Avoids the addition of a space between an identifier and the
55 # initializer list in list-initialization.
56 SpaceBeforeCpp11BracedList: false
57
58 # Indent width for line continuations.
59 ContinuationIndentWidth: 4
60
61 # No indentation for namespaces.
62 NamespaceIndentation: None
63
64 # Braces are usually attached, but not after functions or class declarations
65 # Add SplitEmptyRecord: true to existing BraceWrapping stype
66 BreakBeforeBraces: Custom
67 BraceWrapping:
68 AfterClass: true
69 AfterControlStatement: false
70 AfterEnum: false
71 AfterFunction: true
72 AfterNamespace: false
73 AfterObjCDeclaration: false
74 AfterStruct: true
75 AfterUnion: false
76 BeforeCatch: false
77 BeforeElse: false
78 IndentBraces: false
79 SplitEmptyRecord: true
80
81 # InlineOnly to split empty functions (mainly ctors/dtors) in source file
82 AllowShortFunctionsOnASingleLine: InlineOnly
83
84 # Sort includes in each logical block
85 SortIncludes: true
86 IncludeBlocks: Preserve
87
88 # Put all constructor initializers on the current line if they fit.
89 # Otherwise, try to fit them on the next line or put each one on its own line.
90 PackConstructorInitializers: BinPack
91
92 # When escaping newlines in a macro attach the '\' as far left as possible, e.g.
93 ##define a \
94 # something; \
95 # other; \
96 # thelastlineislong;
97 AlignEscapedNewlines: Left
98
99 # Try to fit as much as possible in the assignment line, break only if necessary
100 PenaltyBreakAssignment: 1000
101
102 # Try to fit as much as possible in the function declaration, break only if necessary
103 AlwaysBreakAfterReturnType: None
104 PenaltyReturnTypeOnItsOwnLine: 100
105
106 # Horizontally align arguments after an open bracket.
107 # The coding style does not specify the following, but this is what gives
108 # results closest to the existing code.
109 AlignAfterOpenBracket: Align
110 AlignArrayOfStructures: Left
111
112 AlwaysBreakTemplateDeclarations: Yes
113
114 # Try to fit all parameters/arguments in one line, break only if necessary
115 BinPackParameters: true
116 BinPackArguments: true
117 PenaltyBreakOpenParenthesis: 1000
118 AllowAllArgumentsOnNextLine: false
119
120 # Comment // namespace <name> after end of the namespace only when it's bigger that 10 lines
121 ShortNamespaceLines: 10
122
123 # Known limitations:
124 # (format by your own judgment and ignore clang-format pre-hook (ONLY IN THAT CASE!))
125 # IndentPPDirectives indents all directives, but some of them shouldn't be indented
126 # e.g #if after #ifndef.
127 #
128 # Function body is either one line or multiline, with breaks after braces and return,
129 # but Qt code style allows body without breaks, if it fits into one line,
130 # even with multiple statements, e.g.
131 # type fun(LooooooongParameter arg)
132 # { type a; return a; }
133 #
134
135 ---
136 # Use the Google-based style for .proto files.
137 Language: Proto
138 BasedOnStyle: Google
139 IndentWidth: 4
140 ColumnLimit: 100