aboutsummaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format125
1 files changed, 82 insertions, 43 deletions
diff --git a/.clang-format b/.clang-format
index 4df5ae84..d4a3d2cc 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,7 +1,7 @@
-# Copyright (C) 2019 Project Quotient
-#
-# You may use this file under the terms of the LGPL-2.1 license
-# See the file LICENSE from this package for details.
+# SPDX-FileCopyrightText: 2019 Kitsune Ral <Kitsune-Ral@users.sf.net>
+# SPDX-FileCopyrightText: 2019 Marc Deop <marc@marcdeop.com>
+
+# SPDX-License-Identifier: LGPL-2.1-or-later
# This is the clang-format configuration style to be used by libQuotient.
# Inspired by:
@@ -14,69 +14,77 @@
# to borrow from the WebKit style. The values for such settings try to but
# are not guaranteed to coincide with the latest version of the WebKit style.
+# This file assumes ClangFormat 12 or newer
+
---
Language: Cpp
BasedOnStyle: WebKit
#AccessModifierOffset: -4
AlignAfterOpenBracket: Align
-#AlignConsecutiveMacros: false
-#AlignConsecutiveAssignments: false
-#AlignConsecutiveDeclarations: false
+#AlignArrayOfStructures: None # ClangFormat 13
+#AlignConsecutiveMacros: None
+#AlignConsecutiveAssignments: None
+#AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
-AlignOperands: true
+AlignOperands: Align
#AlignTrailingComments: false
#AllowAllArgumentsOnNextLine: true
-#AllowAllConstructorInitializersOnNextLine: true
+AllowAllConstructorInitializersOnNextLine: true
#AllowAllParametersOfDeclarationOnNextLine: true
-#AllowShortBlocksOnASingleLine: false # 'Empty' since ClangFormat 10
-#AllowShortCaseLabelsOnASingleLine: false
+#AllowShortEnumsOnASingleLine: true
+#AllowShortBlocksOnASingleLine: Empty
+AllowShortCaseLabelsOnASingleLine: true
#AllowShortFunctionsOnASingleLine: All
#AllowShortLambdasOnASingleLine: All
-#AllowShortIfStatementsOnASingleLine: false # 'Never' since ClangFormat 10
+#AllowShortIfStatementsOnASingleLine: Never
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None # deprecated
#AlwaysBreakAfterReturnType: None
#AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
+#AttributeMacros:
+# - __capability
#BinPackArguments: true
#BinPackParameters: true
BraceWrapping:
- AfterCaseLabel: false
- AfterClass: false
- AfterControlStatement: false
- AfterEnum: false
+# AfterCaseLabel: false
+# AfterClass: false
+ AfterControlStatement: Never # Switch to MultiLine with ClangFormat 14 (https://bugs.llvm.org/show_bug.cgi?id=47936)
+# AfterEnum: false
AfterFunction: true
- AfterNamespace: false
- AfterStruct: false
- AfterUnion: false
- AfterExternBlock: false
- BeforeCatch: false
- BeforeElse: false
- IndentBraces: false
+# AfterNamespace: false
+# AfterStruct: false
+# AfterUnion: false
+# AfterExternBlock: false
+# BeforeCatch: false
+# BeforeElse: false
+# BeforeLambdaBody: false # Blows up lambdas vertically, even if they become _very_ readable
+# BeforeWhile: false
+# IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: NonAssignment
+#BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
-#BreakBeforeInheritanceComma: false
+#BreakBeforeInheritanceComma: false # deprecated?
#BreakInheritanceList: BeforeColon
#BreakBeforeTernaryOperators: true
-#BreakConstructorInitializersBeforeComma: false
+#BreakConstructorInitializersBeforeComma: false # deprecated?
#BreakConstructorInitializers: BeforeComma
#BreakStringLiterals: true
ColumnLimit: 80
-CompactNamespaces: false
+#QualifierAlignment: Leave # ClangFormat 14?
+#CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
-Cpp11BracedListStyle: false
+#Cpp11BracedListStyle: true
#DeriveLineEnding: true
#DerivePointerAlignment: false
-FixNamespaceComments: true
-ForEachMacros:
- - foreach
- - Q_FOREACH
- - forever
+#EmptyLineAfterAccessModifier: Never # ClangFormat 14
+EmptyLineBeforeAccessModifier: LogicalBlock
+#FixNamespaceComments: false # See ShortNamespaces below
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<Qt.+/'
@@ -85,18 +93,25 @@ IncludeCategories:
Priority: 32
- Regex: '"csapi/'
Priority: 2
+ - Regex: '"e2ee/'
+ Priority: 3
- Regex: '"(events|jobs)/'
Priority: 4
- Regex: '.*'
Priority: 1
-#IncludeIsMainRegex: '(_test)?$'
+IncludeIsMainRegex: '(_test)?$'
#IncludeIsMainSourceRegex: ''
+#IndentAccessModifiers: false # ClangFormat 13
#IndentCaseLabels: false
-#IndentGotoLabels: false # Uncomment once on ClangFormat 10
+#IndentCaseBlocks: false
+IndentGotoLabels: false
IndentPPDirectives: AfterHash
+#IndentExternBlock: AfterExternBlock
+IndentRequires: true
#IndentWidth: 4
#IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
+#LambdaBodyIndentation: Signature # ClangFormat 13
#MacroBlockBegin: ''
#MacroBlockEnd: ''
#MaxEmptyLinesToKeep: 1
@@ -105,39 +120,63 @@ PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 70
PenaltyBreakComment: 45
#PenaltyBreakFirstLessLess: 120
+#PenaltyBreakOpenParenthesis: 0 # ClangFormat 14
PenaltyBreakString: 200
#PenaltyBreakTemplateDeclaration: 10
-PenaltyExcessCharacter: 20
-PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyExcessCharacter: 40
+PenaltyReturnTypeOnItsOwnLine: 200
+#PenaltyIndentedWhitespace: 0
#PointerAlignment: Left
+#PPIndentWidth: -1
+#ReferenceAlignment: Pointer # ClangFormat 13
#ReflowComments: true
+#ShortNamespaceLines: 1 # ClangFormat 13 - to use with FixNamespaceComments
#SortIncludes: true
-SortUsingDeclarations: false
+#SortUsingDeclarations: true
#SpaceAfterCStyleCast: false
#SpaceAfterLogicalNot: false
#SpaceAfterTemplateKeyword: true
#SpaceBeforeAssignmentOperators: true
-#SpaceBeforeCpp11BracedList: true
+#SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
#SpaceBeforeParens: ControlStatements
-SpaceBeforeRangeBasedForLoopColon: true
-#SpaceInEmptyBlock: false # Uncomment once on ClangFormat 10
+#SpaceBeforeParensOptions: # ClangFormat 14
+# AfterControlStatements: true
+# AfterForeachMacros: true
+# AfterFunctionDefinitionName: false
+# AfterFunctionDeclarationName: false
+# AfterIfMacros: true
+# AfterOverloadedOperator: false
+# BeforeNonEmptyParentheses: false
+SpaceAroundPointerQualifiers: After
+#SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
#SpaceInEmptyParentheses: false
#SpacesBeforeTrailingComments: 1
-#SpacesInAngles: false
+#SpacesInAngles: false # 'Never' since ClangFormat 13
#SpacesInConditionalStatement: false
-#SpacesInContainerLiterals: true
+SpacesInContainerLiterals: false
#SpacesInCStyleCastParentheses: false
+#SpacesInLineCommentPrefix: # ClangFormat 13
+# Minimum: 1
+# Maximum: -1
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
#SpaceBeforeSquareBrackets: false
-Standard: Cpp11 # Once on ClangFormat 10, switch to Cpp17
+#BitFieldColonSpacing: Both
+Standard: c++20
+StatementAttributeLikeMacros:
+ - Q_EMIT
+ - emit
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
+ - DEFINE_EVENT_TYPEID
TabWidth: 4
#UseCRLF: false
#UseTab: Never
+#WhitespaceSensitiveMacros: [] # Whatever's the default, not using it
...