Debian Codegraph @

.clang-format

raw
1 # Copyright (C) 2016 Olivier Goffart <[email protected]>
2 #
3 # SPDX-License-Identifier: BSD-3-Clause
4 #
5 # You may use this file under the terms of the 3-clause BSD license.
6 # See the file LICENSE from this package for details.
7
8 # This is the clang-format configuration style to be used by Qt,
9 # based on the rules from https://wiki.qt.io/Qt_Coding_Style and
10 # https://wiki.qt.io/Coding_Conventions
11
12 ---
13 # Webkit style was loosely based on the Qt style
14 BasedOnStyle: WebKit
15
16 Standard: c++17
17
18 # Column width is limited to 100 in accordance with Qt Coding Style.
19 # https://wiki.qt.io/Qt_Coding_Style
20 # Note that this may be changed at some point in the future.
21 ColumnLimit: 100
22 # How much weight do extra characters after the line length limit have.
23 # PenaltyExcessCharacter: 4
24
25 # Disable reflow of some specific comments
26 # qdoc comments: indentation rules are different.
27 # Translation comments and SPDX license identifiers are also excluded.
28 CommentPragmas: "^!|^:|^ SPDX-License-Identifier:"
29
30 # We want a space between the type and the star for pointer types.
31 PointerBindsToType: false
32
33 # We generally use "template <" with space.
34 SpaceAfterTemplateKeyword: true
35
36 # We want to break before the operators, but not before a '='.
37 BreakBeforeBinaryOperators: NonAssignment
38
39 # Braces are usually attached, but not after functions or class declarations.
40 BreakBeforeBraces: Custom
41 BraceWrapping:
42 AfterClass: true
43 AfterControlStatement: false
44 AfterEnum: false
45 AfterFunction: true
46 AfterNamespace: false
47 AfterObjCDeclaration: false
48 AfterStruct: true
49 AfterUnion: false
50 BeforeCatch: false
51 BeforeElse: false
52 IndentBraces: false
53
54 # When constructor initializers do not fit on one line, put them each on a new line.
55 ConstructorInitializerAllOnOneLineOrOnePerLine: true
56 # Indent initializers by 4 spaces
57 ConstructorInitializerIndentWidth: 4
58
59 # Indent width for line continuations.
60 ContinuationIndentWidth: 8
61
62 # No indentation for namespaces.
63 NamespaceIndentation: None
64
65 # Allow indentation for preprocessing directives (if/ifdef/endif). https://reviews.llvm.org/rL312125
66 IndentPPDirectives: AfterHash
67 # We only indent with 2 spaces for preprocessor directives
68 PPIndentWidth: 2
69
70 # Horizontally align arguments after an open bracket.
71 # The coding style does not specify the following, but this is what gives
72 # results closest to the existing code.
73 AlignAfterOpenBracket: true
74 AlwaysBreakTemplateDeclarations: true
75
76 # Ideally we should also allow less short function in a single line, but
77 # clang-format does not handle that.
78 AllowShortFunctionsOnASingleLine: Inline
79
80 # The coding style specifies some include order categories, but also tells to
81 # separate categories with an empty line. It does not specify the order within
82 # the categories. Since the SortInclude feature of clang-format does not
83 # re-order includes separated by empty lines, the feature is not used.
84 SortIncludes: false
85
86 # macros for which the opening brace stays attached.
87 ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
88
89 # Break constructor initializers before the colon and after the commas.
90 BreakConstructorInitializers: BeforeColon
91
92 # Add "// namespace <namespace>" comments on closing brace for a namespace
93 # Ignored for namespaces that qualify as a short namespace,
94 # see 'ShortNamespaceLines'
95 FixNamespaceComments: true
96
97 # Definition of how short a short namespace is, default 1
98 ShortNamespaceLines: 1
99
100 # When escaping newlines in a macro attach the '\' as far left as possible, e.g.
101 ##define a \
102 # something; \
103 # other; \
104 # thelastlineislong;
105 AlignEscapedNewlines: Left
106
107 # Avoids the addition of a space between an identifier and the
108 # initializer list in list-initialization.
109 SpaceBeforeCpp11BracedList: false
110
111 ---
112 # Use the Google-based style for .proto files.
113 Language: Proto
114 BasedOnStyle: Google
115 IndentWidth: 4
116 ColumnLimit: 100