reconfigure clang-format

This commit is contained in:
Quinn
2025-03-21 17:38:05 +01:00
committed by Quinn
parent d99f933318
commit fa288545b8
2 changed files with 192 additions and 208 deletions

View File

@@ -1,39 +1,61 @@
--- ---
Language: Cpp # ---------------------------
AccessModifierOffset: -1 # general style settings
AlignAfterOpenBracket: Align # ---------------------------
AlignArrayOfStructures: None BasedOnStyle: '' # (LLVM,Google,Chromium,Mozilla,WebKit,Microsoft,GNU,InheritParentConfig)
AlignConsecutiveMacros: AcrossEmptyLines Standard: Auto # automatically detect the language version
AlignConsecutiveAssignments: false ColumnLimit: 0 # 0: disable column limit
AlignConsecutiveBitFields: LineEnding: LF # use LF line endings
Enabled: true UseTab: ForContinuationAndIndentation # (Never,ForIndentation,ForContinuationAndIndentation,Always)
AcrossEmptyLines: true TabWidth: 4 # recommended to set this equal to IndentWidth
AcrossComments: false IndentWidth: 4 # how wide each indent is
AlignConsecutiveDeclarations: None ContinuationIndentWidth: 4 # width for a line continuation
AlignEscapedNewlines: Left
AlignOperands: Align # ---------------------------
AlignTrailingComments: true # alignment options
AllowAllArgumentsOnNextLine: true # ---------------------------
AllowAllParametersOfDeclarationOnNextLine: false AlignAfterOpenBracket: Align # (Align,DontAlign,AlwaysBreak,BlockIndent)
AllowShortEnumsOnASingleLine: true AlignArrayOfStructures: Left # (Left,Right,None)
AllowShortBlocksOnASingleLine: Always AlignConsecutiveMacros: AcrossEmptyLines # (None,Consecutive,AcrossEmptyLines,AcrossComments,AcrossEmptyLinesAndComments)
AlignConsecutiveAssignments: None # (None,Consecutive,AcrossEmptyLines,AcrossComments,AcrossEmptyLinesAndComments)
AlignConsecutiveBitFields: AcrossEmptyLines # (None,Consecutive,AcrossEmptyLines,AcrossComments,AcrossEmptyLinesAndComments)
AlignConsecutiveDeclarations: None # (None,Consecutive,AcrossEmptyLines,AcrossComments,AcrossEmptyLinesAndComments)
AlignEscapedNewlines: Left # (DontAlign,Left,LeftWithLastLine,Right)
AlignOperands: Align # (DontAlign,Align,AlignAfterOperator)
AlignTrailingComments: Always # (Leave,Always,Never)
# ---------------------------
# short constructs on a single line
# ---------------------------
AllowShortBlocksOnASingleLine: Always # (Never,Empty,Always)
AllowShortFunctionsOnASingleLine: All # (None,InlineOnly,Empty,All)
AllowShortLambdasOnASingleLine: All # (None,Empty,Inline,All)
AllowShortIfStatementsOnASingleLine: AllIfsAndElse # (Never,WithoutElse,OnlyFirstIf,AllIfsAndElse)
AllowShortCaseLabelsOnASingleLine: true AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty AllowShortEnumsOnASingleLine: true
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AllowShortLoopsOnASingleLine: true AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None # ---------------------------
AlwaysBreakBeforeMultilineStrings: true # break and wrapping options
AlwaysBreakTemplateDeclarations: Yes # ---------------------------
AttributeMacros: AlwaysBreakBeforeMultilineStrings: true # when defining multi-line strings, linebreak should be inserted
- __capability BreakAfterReturnType: Automatic # is decided by PenaltyReturnTypeOnItsOwnLine
BinPackArguments: false BreakTemplateDeclarations: MultiLine # (Leave,No,MultiLine,Yes)
BinPackParameters: true BreakBeforeBinaryOperators: None # (None,NonAssignment,All)
BreakBeforeConceptDeclarations: Never # (Never,Allowed,Always)
BreakBeforeBraces: Attach # (Attach,Linux,Mozilla,Stroustrup,Allman,Whitesmiths,GNU,WebKit,Custom)
BreakInheritanceList: BeforeColon # (BeforeColon,BeforeComma,AfterColon)
BreakConstructorInitializers: BeforeColon # (BeforeColon,BeforeComma,AfterColon)
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
# ---------------------------
# brace wrapping configuration
# ---------------------------
BraceWrapping: BraceWrapping:
AfterControlStatement: Never # (Never,MultiLine,Always)
AfterCaseLabel: false AfterCaseLabel: false
AfterClass: false AfterClass: false
AfterControlStatement: Never
AfterEnum: false AfterEnum: false
AfterFunction: false AfterFunction: false
AfterNamespace: false AfterNamespace: false
@@ -46,145 +68,94 @@ BraceWrapping:
BeforeLambdaBody: false BeforeLambdaBody: false
BeforeWhile: false BeforeWhile: false
IndentBraces: false IndentBraces: false
SplitEmptyFunction: true SplitEmptyFunction: false
SplitEmptyRecord: true SplitEmptyRecord: false
SplitEmptyNamespace: true SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true # ---------------------------
BreakBeforeBraces: Attach # constructor initializer and parameter packing options
BreakBeforeInheritanceComma: false # ---------------------------
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4 PackConstructorInitializers: BinPack # (Never,BinPack,CurrentLine,NextLine,NextLineOnly)
Cpp11BracedListStyle: true BinPackParameters: true # use bin-packing for paramter lists
DeriveLineEnding: true BinPackArguments: false # false: function calls either on one line or one per line
DerivePointerAlignment: false
DisableFormat: false # ---------------------------
EmptyLineAfterAccessModifier: Never # pointer alignment
EmptyLineBeforeAccessModifier: LogicalBlock # ---------------------------
ExperimentalAutoDetectBinPacking: false DerivePointerAlignment: false # automatically detect pointer alignment
PackConstructorInitializers: NextLine PointerAlignment: Left # (Left,Right,Middle)
BasedOnStyle: '' ReferenceAlignment: Pointer # (Pointer,Left,Right,Middle)
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true # ---------------------------
FixNamespaceComments: true # include settings and sorting
# ---------------------------
IncludeIsMainSourceRegex: '' # only [*.{c,cc,cpp,c++,cxx,m,mm}] are considered to be "main"
IncludeIsMainRegex: '([-_](test|unittest))?$' # regex used for identifying an include as "main", to assign catagory 0
IncludeBlocks: Regroup # (Preserve,Merge,Regroup)
IncludeCategories:
- Regex: '^<.*\.h>' # system headers
Priority: 1
SortPriority: 0
CaseSensitive: true
- Regex: '^".*' # custom headers
Priority: 2
SortPriority: 0
CaseSensitive: true
# ---------------------------
# macro and language-specific settings
# ---------------------------
AttributeMacros:
- __capability
ForEachMacros: ForEachMacros:
- foreach - foreach
- Q_FOREACH - Q_FOREACH
- BOOST_FOREACH - BOOST_FOREACH
IfMacros: IfMacros:
- KJ_IF_MAYBE - KJ_IF_MAYBE
IncludeBlocks: Regroup StatementAttributeLikeMacros:
IncludeCategories: - Q_EMIT
- Regex: '^<ext/.*\.h>' StatementMacros:
Priority: 2 - Q_UNUSED
SortPriority: 0 - QT_REQUIRE_VERSION
CaseSensitive: false WhitespaceSensitiveMacros:
- Regex: '^<.*\.h>' - STRINGIZE
Priority: 1 - PP_STRINGIZE
SortPriority: 0 - BOOST_PP_STRINGIZE
CaseSensitive: false - NS_SWIFT_NAME
- Regex: '^<.*' - CF_SWIFT_NAME
Priority: 2
SortPriority: 0 # ---------------------------
CaseSensitive: false # additional formatting and sorting details
- Regex: '.*' # ---------------------------
Priority: 3 AllowAllArgumentsOnNextLine: false
SortPriority: 0 AllowAllParametersOfDeclarationOnNextLine: false
CaseSensitive: false EmptyLineAfterAccessModifier: Never # (Never,Leave,Always)
IncludeIsMainRegex: '([-_](test|unittest))?$' EmptyLineBeforeAccessModifier: LogicalBlock # (Never,Leave,LogicalBlock,Always)
IncludeIsMainSourceRegex: '' ExperimentalAutoDetectBinPacking: false
IndentAccessModifiers: false FixNamespaceComments: true # adds comments at namespace delimiters
IndentCaseLabels: false MaxEmptyLinesToKeep: 4 # what the maximum amount of empty lines that we're allowed to keep
IndentCaseBlocks: false ReflowComments: true # reflow comment text to match column limits
IndentGotoLabels: true RemoveBracesLLVM: false # don't automatically remove braces
IndentPPDirectives: None SeparateDefinitionBlocks: Leave # (Leave,Always.Never)
IndentExternBlock: AfterExternBlock ShortNamespaceLines: 1 # how many lines a namespaces can be to be regarded "short"
IndentRequires: false SortIncludes: CaseSensitive # (Never,CaseSensitive,CaseInsensitive)
IndentWidth: 4 SortJavaStaticImport: Before # (After,Before)
IndentWrappedFunctionNames: false SortUsingDeclarations: LexicographicNumeric # (Never,Lexicographic,LexicographicNumeric)
InsertTrailingCommas: Wrapped
JavaScriptQuotes: Double # ---------------------------
JavaScriptWrapImports: true # spacing options
KeepEmptyLinesAtTheStartOfBlocks: false # ---------------------------
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 4
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: 1
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements # (ControlStatements,ControlStatementsExceptControlMacros,NonEmptyParentheses,Always,Custom)
SpaceBeforeParensOptions: SpaceBeforeParensOptions:
AfterControlStatements: true AfterControlStatements: true
AfterForeachMacros: true AfterForeachMacros: true
@@ -193,36 +164,47 @@ SpaceBeforeParensOptions:
AfterIfMacros: true AfterIfMacros: true
AfterOverloadedOperator: false AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default SpaceAroundPointerQualifiers: Default # (Default,Before,After,Both) recommend to use Default and let PointerAlignment decide
SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false SpacesInParens: Custom
SpacesInParensOptions:
ExceptDoubleParentheses: false
InConditionalStatements: false
InCStyleCasts: false
Other: false
SpacesBeforeTrailingComments: 1 SpacesBeforeTrailingComments: 1
SpacesInAngles: Never SpacesInAngles: Never # (Never,Always,Leave)
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix: SpacesInLineCommentPrefix:
Minimum: 1 Minimum: 1
Maximum: 1 Maximum: 1
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both BitFieldColonSpacing: Both # (Both,None,Before,After)
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
# ---------------------------
# indentation details
# ---------------------------
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentExternBlock: AfterExternBlock # (AfterExternBlock,NoIndent,Indent)
IndentRequiresClause: false
IndentPPDirectives: AfterHash # preprocessor indent style (None,AfterHash,BeforeHash)
PPIndentWidth: 1
---
# ---------------------------
# Objective-C specific settings
# ---------------------------
Language: ObjC
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
...

View File

@@ -1,2 +1,4 @@
CompileFlags: CompileFlags:
Add: [-std=c17]
Add: [-Wall, -Wextra, Wpedantic, -Wno-pointer-arith]
Add: [-DDEBUG] Add: [-DDEBUG]