Use clang-format for code style consistency

Based on the WebKit preset and following 'most' of the Qt guidelines, except a few rules that work better for promise continuation lambdas. Requires clang-format 11.
This commit is contained in:
Simon Brunel
2020-03-21 14:23:40 +01:00
parent b99e468c84
commit d43657fbd5
40 changed files with 1534 additions and 1223 deletions

66
.clang-format Normal file
View File

@ -0,0 +1,66 @@
---
Language: Cpp
Standard: Cpp11
BasedOnStyle: WebKit
AlignAfterOpenBracket: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterStruct: true
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakInheritanceList: BeforeComma
BreakConstructorInitializers: BeforeColon
ColumnLimit: 100
CommentPragmas: "^!|^:"
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
Cpp11BracedListStyle: true
FixNamespaceComments: true
ForEachMacros:
- BOOST_FOREACH
- foreach
- forever
- Q_FOREACH
- Q_FOREVER
- QBENCHMARK
- QBENCHMARK_ONCE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<Q.*>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 3
SortPriority: 0
- Regex: '^<.*>'
Priority: 4
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IndentPPDirectives: AfterHash
NamespaceIndentation: None
PenaltyReturnTypeOnItsOwnLine: 10
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: false
...