update clang format formatting rules to be up to par with my current preferences

This commit is contained in:
2025-07-03 10:43:21 +02:00
parent 2f31b9c6e8
commit 9f7a1b594f

View File

@@ -2,27 +2,30 @@
# --------------------------- # ---------------------------
# 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
AlignTrailingComments: true
AlignConsecutiveMacros: AcrossEmptyLines AlignConsecutiveMacros: AcrossEmptyLines
AlignEscapedNewlines: Left
AlignArrayOfStructures: None
AlignConsecutiveAssignments: None AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: AcrossEmptyLines AlignConsecutiveBitFields: AcrossEmptyLines
AlignConsecutiveDeclarations: None AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left AlignConsecutiveShortCaseStatements:
AlignOperands: DontAlign Enabled: true
AlignTrailingComments: Always
# --------------------------- # ---------------------------
# short constructs on a single line # short constructs on a single line
@@ -38,16 +41,14 @@ AllowShortLoopsOnASingleLine: true
# --------------------------- # ---------------------------
# break and wrapping options # break and wrapping options
# --------------------------- # ---------------------------
AlwaysBreakBeforeMultilineStrings: true AlwaysBreakBeforeMultilineStrings: false
BreakAfterReturnType: Automatic AlwaysBreakAfterReturnType: Automatic
BreakTemplateDeclarations: MultiLine BreakTemplateDeclarations: false
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Never BreakBeforeConceptDeclarations: Never
BreakBeforeBraces: Attach BreakBeforeBraces: Custom
BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon BreakStringLiterals: false
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
# --------------------------- # ---------------------------
# brace wrapping configuration # brace wrapping configuration
@@ -68,25 +69,25 @@ BraceWrapping:
BeforeLambdaBody: false BeforeLambdaBody: false
BeforeWhile: false BeforeWhile: false
IndentBraces: false IndentBraces: false
SplitEmptyFunction: false SplitEmptyFunction: true
SplitEmptyRecord: false SplitEmptyRecord: true
SplitEmptyNamespace: false SplitEmptyNamespace: true
# --------------------------- # ---------------------------
# 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
# --------------------------- # ---------------------------
DerivePointerAlignment: false DerivePointerAlignment: false
PointerAlignment: Right PointerAlignment: Right
ReferenceAlignment: Pointer ReferenceAlignment: Pointer
QualifierAlignment: Right QualifierAlignment: Right
# --------------------------- # ---------------------------
# include settings and sorting # include settings and sorting
@@ -104,68 +105,37 @@ 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
RemoveBracesLLVM: 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 SortIncludes: CaseSensitive
SortJavaStaticImport: Before SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric SortUsingDeclarations: false
# --------------------------- # ---------------------------
# spacing options # spacing options
# --------------------------- # ---------------------------
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false SpaceBeforeCaseColon: false
Cpp11BracedListStyle: true
SpaceBeforeCpp11BracedList: 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 SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true SpaceInEmptyBlock: true
SpacesInParens: Custom SpacesInParens: Custom
@@ -177,7 +147,8 @@ SpacesInParensOptions:
SpacesBeforeTrailingComments: 1 SpacesBeforeTrailingComments: 1
SpacesInAngles: Never SpacesInAngles: Never
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix: SpacesInLineCommentPrefix:
Minimum: 1 Minimum: 1
Maximum: 1 Maximum: 1
@@ -186,6 +157,17 @@ 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
# --------------------------- # ---------------------------
@@ -197,15 +179,4 @@ 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
... ...