rewrite clang-format

This commit is contained in:
2025-07-02 23:55:22 +02:00
parent 84439a56f6
commit fb280c1359

View File

@@ -2,32 +2,34 @@
# --------------------------- # ---------------------------
# general style settings # general style settings
# --------------------------- # ---------------------------
BasedOnStyle: '' BasedOnStyle: GNU
Standard: Auto Standard: Auto
ColumnLimit: 0 ColumnLimit: 0
LineEnding: LF LineEnding: LF
UseTab: ForContinuationAndIndentation UseTab: ForContinuationAndIndentation
TabWidth: 4 TabWidth: 8
IndentWidth: 4 IndentWidth: 8
ContinuationIndentWidth: 4 ContinuationIndentWidth: 8
AccessModifierOffset: -4
# --------------------------- # ---------------------------
# alignment options # alignment options
# --------------------------- # ---------------------------
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left AlignOperands: DontAlign
AlignConsecutiveMacros: AcrossEmptyLines AlignTrailingComments: true
AlignConsecutiveAssignments: None AlignEscapedNewlines: Right
AlignArrayOfStructures: None
AlignConsecutiveBitFields: AcrossEmptyLines AlignConsecutiveBitFields: AcrossEmptyLines
AlignConsecutiveDeclarations: None AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left AlignConsecutiveMacros: AcrossEmptyLines
AlignOperands: DontAlign AlignConsecutiveShortCaseStatements:
AlignTrailingComments: Always Enabled: true
# --------------------------- # ---------------------------
# short constructs on a single line # short constructs on a single line
# --------------------------- # ---------------------------
AllowShortBlocksOnASingleLine: Always AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse AllowShortIfStatementsOnASingleLine: AllIfsAndElse
@@ -38,47 +40,46 @@ AllowShortLoopsOnASingleLine: true
# --------------------------- # ---------------------------
# break and wrapping options # break and wrapping options
# --------------------------- # ---------------------------
AlwaysBreakBeforeMultilineStrings: true AlwaysBreakAfterReturnType: Automatic
BreakAfterReturnType: Automatic AlwaysBreakBeforeMultilineStrings: false
BreakTemplateDeclarations: MultiLine BreakTemplateDeclarations: false
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakStringLiterals: false
BreakConstructorInitializers: BeforeComma
BreakBeforeConceptDeclarations: Never BreakBeforeConceptDeclarations: Never
BreakBeforeBraces: Attach
BreakInheritanceList: BeforeColon
BreakConstructorInitializers: BeforeColon
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
# --------------------------- # ---------------------------
# brace wrapping configuration # brace wrapping configuration
# --------------------------- # ---------------------------
BraceWrapping: BraceWrapping:
AfterControlStatement: Never
AfterCaseLabel: false
AfterClass: false AfterClass: false
AfterControlStatement: Never
AfterEnum: false AfterEnum: false
AfterFunction: false AfterFunction: false
AfterNamespace: false AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false AfterStruct: false
AfterUnion: false AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false BeforeElse: false
BeforeCatch: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
AfterCaseLabel: false
AfterObjCDeclaration: false
AfterExternBlock: false
BeforeLambdaBody: false BeforeLambdaBody: false
BeforeWhile: false BeforeWhile: false
IndentBraces: false IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# --------------------------- # ---------------------------
# constructor initializer and parameter packing options # constructor initializer and parameter packing options
# --------------------------- # ---------------------------
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 8
PackConstructorInitializers: BinPack PackConstructorInitializers: NextLine
BinPackParameters: true BinPackParameters: true
BinPackArguments: false BinPackArguments: true
# --------------------------- # ---------------------------
# pointer alignment # pointer alignment
@@ -104,108 +105,76 @@ IncludeCategories:
SortPriority: 0 SortPriority: 0
CaseSensitive: true CaseSensitive: true
# ---------------------------
# macro and language-specific settings
# ---------------------------
AttributeMacros:
- __capability
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
# --------------------------- # ---------------------------
# additional formatting and sorting details # additional formatting and sorting details
# --------------------------- # ---------------------------
FixNamespaceComments: false
MaxEmptyLinesToKeep: 2
ReflowComments: false
SortIncludes: Never
SortUsingDeclarations: false
IndentCaseLabels: false
IndentGotoLabels: false
AllowAllArgumentsOnNextLine: false AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
EmptyLineAfterAccessModifier: Never EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
MaxEmptyLinesToKeep: 4
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1 ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
# --------------------------- # ---------------------------
# spacing options # spacing options
# --------------------------- # ---------------------------
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpacesInParens: Custom SpacesInParens: Custom
SpacesInParensOptions: SpacesInParensOptions:
ExceptDoubleParentheses: false ExceptDoubleParentheses: false
InConditionalStatements: false InConditionalStatements: false
InCStyleCasts: false InCStyleCasts: false
Other: false Other: false
SpacesBeforeTrailingComments: 1 SpaceBeforeRangeBasedForLoopColon: true
SpacesInAngles: Never SpacesInAngles: Never
SpacesInConditionalStatement: false SpacesInContainerLiterals: false
SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesBeforeTrailingComments: 1
SpaceAfterLogicalNot: false
SpaceBeforeCaseColon: false
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: false
SpaceInEmptyBlock: true
SpacesInLineCommentPrefix: SpacesInLineCommentPrefix:
Minimum: 1 Minimum: 1
Maximum: 1 Maximum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both BitFieldColonSpacing: Both
# ---------------------------
# penalty settings
# ---------------------------
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60
# --------------------------- # ---------------------------
# indentation details # indentation details
# --------------------------- # ---------------------------
IndentAccessModifiers: false IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false IndentCaseBlocks: false
IndentGotoLabels: true
IndentExternBlock: AfterExternBlock IndentExternBlock: AfterExternBlock
IndentRequiresClause: false IndentRequiresClause: false
IndentPPDirectives: None IndentPPDirectives: None
PPIndentWidth: 1 PPIndentWidth: 1
---
# ---------------------------
# Objective-C specific settings
# ---------------------------
Language: ObjC
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
... ...