1# Copyright (C) 2019 Project Quotient 2# 3# You may use this file under the terms of the LGPL-2.1 license 4# See the file LICENSE from this package for details. 5 6# This is the clang-format configuration style to be used by libQuotient. 7# Inspired by: 8# https://code.qt.io/cgit/qt/qt5.git/plain/_clang-format 9# https://wiki.qt.io/Qt_Coding_Style 10# https://wiki.qt.io/Coding_Conventions 11# Further information: https://clang.llvm.org/docs/ClangFormatStyleOptions.html 12 13# For convenience, the file includes commented out settings that we assume 14# to borrow from the WebKit style. The values for such settings try to but 15# are not guaranteed to coincide with the latest version of the WebKit style. 16 17--- 18Language: Cpp 19BasedOnStyle: WebKit 20#AccessModifierOffset: -4 21AlignAfterOpenBracket: Align 22#AlignConsecutiveMacros: false 23#AlignConsecutiveAssignments: false 24#AlignConsecutiveDeclarations: false 25AlignEscapedNewlines: Left 26AlignOperands: true 27#AlignTrailingComments: false 28#AllowAllArgumentsOnNextLine: true 29#AllowAllConstructorInitializersOnNextLine: true 30#AllowAllParametersOfDeclarationOnNextLine: true 31#AllowShortBlocksOnASingleLine: false # 'Empty' since ClangFormat 10 32#AllowShortCaseLabelsOnASingleLine: false 33#AllowShortFunctionsOnASingleLine: All 34#AllowShortLambdasOnASingleLine: All 35#AllowShortIfStatementsOnASingleLine: false # 'Never' since ClangFormat 10 36#AllowShortLoopsOnASingleLine: false 37#AlwaysBreakAfterDefinitionReturnType: None # deprecated 38#AlwaysBreakAfterReturnType: None 39#AlwaysBreakBeforeMultilineStrings: false 40AlwaysBreakTemplateDeclarations: Yes 41#BinPackArguments: true 42#BinPackParameters: true 43BraceWrapping: 44 AfterCaseLabel: false 45 AfterClass: false 46 AfterControlStatement: false 47 AfterEnum: false 48 AfterFunction: true 49 AfterNamespace: false 50 AfterStruct: false 51 AfterUnion: false 52 AfterExternBlock: false 53 BeforeCatch: false 54 BeforeElse: false 55 IndentBraces: false 56 SplitEmptyFunction: false 57 SplitEmptyRecord: false 58 SplitEmptyNamespace: false 59BreakBeforeBinaryOperators: NonAssignment 60BreakBeforeBraces: Custom 61#BreakBeforeInheritanceComma: false 62#BreakInheritanceList: BeforeColon 63#BreakBeforeTernaryOperators: true 64#BreakConstructorInitializersBeforeComma: false 65#BreakConstructorInitializers: BeforeComma 66#BreakStringLiterals: true 67ColumnLimit: 80 68CompactNamespaces: false 69ConstructorInitializerAllOnOneLineOrOnePerLine: true 70#ConstructorInitializerIndentWidth: 4 71#ContinuationIndentWidth: 4 72Cpp11BracedListStyle: false 73#DeriveLineEnding: true 74#DerivePointerAlignment: false 75FixNamespaceComments: true 76ForEachMacros: 77 - foreach 78 - Q_FOREACH 79 - forever 80IncludeBlocks: Regroup 81IncludeCategories: 82 - Regex: '^<Qt.+/' 83 Priority: 24 84 - Regex: '^<' 85 Priority: 32 86 - Regex: '"csapi/' 87 Priority: 2 88 - Regex: '"(events|jobs)/' 89 Priority: 4 90 - Regex: '.*' 91 Priority: 1 92#IncludeIsMainRegex: '(_test)?$' 93#IncludeIsMainSourceRegex: '' 94#IndentCaseLabels: false 95#IndentGotoLabels: false # Uncomment once on ClangFormat 10 96IndentPPDirectives: AfterHash 97#IndentWidth: 4 98#IndentWrappedFunctionNames: false 99KeepEmptyLinesAtTheStartOfBlocks: false 100#MacroBlockBegin: '' 101#MacroBlockEnd: '' 102#MaxEmptyLinesToKeep: 1 103#NamespaceIndentation: Inner 104PenaltyBreakAssignment: 10 105PenaltyBreakBeforeFirstCallParameter: 70 106PenaltyBreakComment: 45 107#PenaltyBreakFirstLessLess: 120 108PenaltyBreakString: 200 109#PenaltyBreakTemplateDeclaration: 10 110PenaltyExcessCharacter: 20 111PenaltyReturnTypeOnItsOwnLine: 60 112#PointerAlignment: Left 113#ReflowComments: true 114#SortIncludes: true 115SortUsingDeclarations: false 116#SpaceAfterCStyleCast: false 117#SpaceAfterLogicalNot: false 118#SpaceAfterTemplateKeyword: true 119#SpaceBeforeAssignmentOperators: true 120#SpaceBeforeCpp11BracedList: true 121#SpaceBeforeCtorInitializerColon: true 122#SpaceBeforeInheritanceColon: true 123#SpaceBeforeParens: ControlStatements 124SpaceBeforeRangeBasedForLoopColon: true 125#SpaceInEmptyBlock: false # Uncomment once on ClangFormat 10 126#SpaceInEmptyParentheses: false 127#SpacesBeforeTrailingComments: 1 128#SpacesInAngles: false 129#SpacesInConditionalStatement: false 130#SpacesInContainerLiterals: true 131#SpacesInCStyleCastParentheses: false 132#SpacesInParentheses: false 133#SpacesInSquareBrackets: false 134#SpaceBeforeSquareBrackets: false 135Standard: Cpp11 # Once on ClangFormat 10, switch to Cpp17 136StatementMacros: 137 - Q_UNUSED 138 - QT_REQUIRE_VERSION 139TabWidth: 4 140#UseCRLF: false 141#UseTab: Never 142... 143 144