CI: Update pre-commit clang-format to 18.1.8

• Modernized `.clang-format` file against latest LLVM config settings
This commit is contained in:
Thaddeus Crews 2024-06-18 10:36:58 -05:00
parent 0a4aedb360
commit 72c183ce8b
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
2 changed files with 181 additions and 132 deletions

View File

@ -1,29 +1,59 @@
# Commented out parameters are those with the same value as base LLVM style. # Commented out parameters are those with the same value as base LLVM style.
# We can uncomment them if we want to change their value, or enforce the # We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 14.0). # chosen value in case the base style changes (last sync: Clang 18.1.8).
---
### General config, applies to all languages ###
BasedOnStyle: LLVM BasedOnStyle: LLVM
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: DontAlign
# AlignArrayOfStructures: None # AlignArrayOfStructures: None
# AlignConsecutiveMacros: None # AlignConsecutiveAssignments:
# AlignConsecutiveAssignments: None # Enabled: false
# AlignConsecutiveBitFields: None # AcrossEmptyLines: false
# AlignConsecutiveDeclarations: None # AcrossComments: false
# AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: true
# AlignConsecutiveBitFields:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false
# AlignConsecutiveDeclarations:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false
# AlignConsecutiveMacros:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCompound: false
# AlignFunctionPointers: false
# PadOperators: false
# AlignConsecutiveShortCaseStatements:
# Enabled: false
# AcrossEmptyLines: false
# AcrossComments: false
# AlignCaseColons: false
# AlignEscapedNewlines: Right # AlignEscapedNewlines: Right
AlignOperands: DontAlign AlignOperands: DontAlign
AlignTrailingComments: false AlignTrailingComments:
Kind: Never
OverEmptyLines: 0
# AllowAllArgumentsOnNextLine: true # AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortEnumsOnASingleLine: true # AllowBreakBeforeNoexceptSpecifier: Never
# AllowShortBlocksOnASingleLine: Never # AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false # AllowShortCaseLabelsOnASingleLine: false
# AllowShortCompoundRequirementOnASingleLine: true
# AllowShortEnumsOnASingleLine: true
# AllowShortFunctionsOnASingleLine: All # AllowShortFunctionsOnASingleLine: All
# AllowShortLambdasOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: Never # AllowShortIfStatementsOnASingleLine: Never
# AllowShortLambdasOnASingleLine: All
# AllowShortLoopsOnASingleLine: false # AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None # AlwaysBreakAfterReturnType: None
# AlwaysBreakBeforeMultilineStrings: false # AlwaysBreakBeforeMultilineStrings: false
# AlwaysBreakTemplateDeclarations: MultiLine # AlwaysBreakTemplateDeclarations: MultiLine
@ -31,6 +61,7 @@ AllowAllParametersOfDeclarationOnNextLine: false
# - __capability # - __capability
# BinPackArguments: true # BinPackArguments: true
# BinPackParameters: true # BinPackParameters: true
# BitFieldColonSpacing: Both
# BraceWrapping: # BraceWrapping:
# AfterCaseLabel: false # AfterCaseLabel: false
# AfterClass: false # AfterClass: false
@ -50,31 +81,29 @@ AllowAllParametersOfDeclarationOnNextLine: false
# SplitEmptyFunction: true # SplitEmptyFunction: true
# SplitEmptyRecord: true # SplitEmptyRecord: true
# SplitEmptyNamespace: true # SplitEmptyNamespace: true
# BreakAdjacentStringLiterals: true
# BreakAfterAttributes: Leave
# BreakAfterJavaFieldAnnotations: false
# BreakArrays: true
# BreakBeforeBinaryOperators: None # BreakBeforeBinaryOperators: None
# BreakBeforeConceptDeclarations: true
# BreakBeforeBraces: Attach # BreakBeforeBraces: Attach
# BreakBeforeInheritanceComma: false # BreakBeforeConceptDeclarations: Always
# BreakInheritanceList: BeforeColon # BreakBeforeInlineASMColon: OnlyMultiline
# BreakBeforeTernaryOperators: true # BreakBeforeTernaryOperators: true
# BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon BreakConstructorInitializers: AfterColon
# BreakInheritanceList: BeforeColon
# BreakStringLiterals: true # BreakStringLiterals: true
ColumnLimit: 0 ColumnLimit: 0
# CommentPragmas: '^ IWYU pragma:' # CommentPragmas: '^ IWYU pragma:'
# QualifierAlignment: Leave
# CompactNamespaces: false # CompactNamespaces: false
ConstructorInitializerIndentWidth: 8 ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8 ContinuationIndentWidth: 8
Cpp11BracedListStyle: false Cpp11BracedListStyle: false
# DeriveLineEnding: true
# DerivePointerAlignment: false # DerivePointerAlignment: false
# DisableFormat: false # DisableFormat: false
# EmptyLineAfterAccessModifier: Never # EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock # EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false # ExperimentalAutoDetectBinPacking: false
# PackConstructorInitializers: BinPack
ConstructorInitializerAllOnOneLineOrOnePerLine: true
# AllowAllConstructorInitializersOnNextLine: true
# FixNamespaceComments: true # FixNamespaceComments: true
# ForEachMacros: # ForEachMacros:
# - foreach # - foreach
@ -84,116 +113,136 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
# - KJ_IF_MAYBE # - KJ_IF_MAYBE
# IncludeBlocks: Preserve # IncludeBlocks: Preserve
IncludeCategories: IncludeCategories:
- Regex: '".*"' - Regex: ^".*"$
Priority: 1 Priority: 1
- Regex: '^<.*\.h>' - Regex: ^<.*\.h>$
Priority: 2 Priority: 2
- Regex: '^<.*' - Regex: ^<.*>$
Priority: 3 Priority: 3
# IncludeIsMainRegex: '(Test)?$' # IncludeIsMainRegex: (Test)?$
# IncludeIsMainSourceRegex: '' # IncludeIsMainSourceRegex: ''
# IndentAccessModifiers: false # IndentAccessModifiers: false
IndentCaseLabels: true
# IndentCaseBlocks: false # IndentCaseBlocks: false
IndentCaseLabels: true
# IndentExternBlock: AfterExternBlock
# IndentGotoLabels: true # IndentGotoLabels: true
# IndentPPDirectives: None # IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock # IndentRequiresClause: true
# IndentRequires: false
IndentWidth: 4 IndentWidth: 4
# IndentWrappedFunctionNames: false # IndentWrappedFunctionNames: false
# InsertBraces: false
# InsertNewlineAtEOF: false
# InsertTrailingCommas: None # InsertTrailingCommas: None
# IntegerLiteralSeparator:
# Binary: 0
# BinaryMinDigits: 0
# Decimal: 0
# DecimalMinDigits: 0
# Hex: 0
# HexMinDigits: 0
JavaImportGroups:
- org.godotengine
- android
- androidx
- com.android
- com.google
- java
- javax
# JavaScriptQuotes: Leave # JavaScriptQuotes: Leave
# JavaScriptWrapImports: true # JavaScriptWrapImports: true
# KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
# LambdaBodyIndentation: Signature # LambdaBodyIndentation: Signature
# Language: Cpp
# LineEnding: DeriveLF
# MacroBlockBegin: '' # MacroBlockBegin: ''
# MacroBlockEnd: '' # MacroBlockEnd: ''
# MaxEmptyLinesToKeep: 1 # MaxEmptyLinesToKeep: 1
# NamespaceIndentation: None # NamespaceIndentation: None
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
# PPIndentWidth: -1
PackConstructorInitializers: NextLine
# PenaltyBreakAssignment: 2 # PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19 # PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300 # PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120 # PenaltyBreakFirstLessLess: 120
# PenaltyBreakOpenParenthesis: 0 # PenaltyBreakOpenParenthesis: 0
# PenaltyBreakScopeResolution: 500
# PenaltyBreakString: 1000 # PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10 # PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000 # PenaltyExcessCharacter: 1000000
# PenaltyReturnTypeOnItsOwnLine: 60
# PenaltyIndentedWhitespace: 0 # PenaltyIndentedWhitespace: 0
# PenaltyReturnTypeOnItsOwnLine: 60
# PointerAlignment: Right # PointerAlignment: Right
# PPIndentWidth: -1 # QualifierAlignment: Leave
# ReferenceAlignment: Pointer # ReferenceAlignment: Pointer
# ReflowComments: true # ReflowComments: true
# RemoveBracesLLVM: false # RemoveBracesLLVM: false
# RemoveParentheses: Leave
# RemoveSemicolon: false
# RequiresClausePosition: OwnLine
# RequiresExpressionIndentation: OuterScope
# SeparateDefinitionBlocks: Leave # SeparateDefinitionBlocks: Leave
# ShortNamespaceLines: 1 # ShortNamespaceLines: 1
# SkipMacroDefinitionBody: false
# SortIncludes: CaseSensitive # SortIncludes: CaseSensitive
# SortJavaStaticImport: Before # SortJavaStaticImport: Before
# SortUsingDeclarations: true # SortUsingDeclarations: LexicographicNumeric
# SpaceAfterCStyleCast: false # SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false # SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true # SpaceAfterTemplateKeyword: true
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeAssignmentOperators: true # SpaceBeforeAssignmentOperators: true
# SpaceBeforeCaseColon: false # SpaceBeforeCaseColon: false
# SpaceBeforeCpp11BracedList: false # SpaceBeforeCpp11BracedList: false
# SpaceBeforeCtorInitializerColon: true # SpaceBeforeCtorInitializerColon: true
# SpaceBeforeInheritanceColon: true # SpaceBeforeInheritanceColon: true
# SpaceBeforeParens: ControlStatements # SpaceBeforeJsonColon: false
# SpaceBeforeParensOptions: # SpaceBeforeParensOptions:
# AfterControlStatements: true # AfterControlStatements: true
# AfterForeachMacros: true # AfterForeachMacros: true
# AfterFunctionDefinitionName: false
# AfterFunctionDeclarationName: false # AfterFunctionDeclarationName: false
# AfterFunctionDefinitionName: false
# AfterIfMacros: true # AfterIfMacros: true
# AfterOverloadedOperator: false # AfterOverloadedOperator: false
# AfterPlacementOperator: true
# AfterRequiresInClause: false
# AfterRequiresInExpression: false
# BeforeNonEmptyParentheses: false # BeforeNonEmptyParentheses: false
# SpaceAroundPointerQualifiers: Default
# SpaceBeforeRangeBasedForLoopColon: true # SpaceBeforeRangeBasedForLoopColon: true
# SpaceBeforeSquareBrackets: false
# SpaceInEmptyBlock: false # SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1 # SpacesBeforeTrailingComments: 1
# SpacesInAngles: Never # SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true # SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix ## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
## our comment capitalization at the same time. ## our comment capitalization at the same time.
SpacesInLineCommentPrefix: SpacesInLineCommentPrefix:
Minimum: 0 Minimum: 0
Maximum: -1 Maximum: -1
# SpacesInParentheses: false # SpacesInParens: Never
# SpacesInParensOptions:
# InConditionalStatements: false
# InCStyleCasts: false
# InEmptyParentheses: false
# Other: false
# SpacesInSquareBrackets: false # SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false Standard: c++17
# BitFieldColonSpacing: Both
# StatementAttributeLikeMacros: # StatementAttributeLikeMacros:
# - Q_EMIT # - Q_EMIT
# StatementMacros: # StatementMacros:
# - Q_UNUSED # - Q_UNUSED
# - QT_REQUIRE_VERSION # - QT_REQUIRE_VERSION
TabWidth: 4 TabWidth: 4
# UseCRLF: false
UseTab: Always UseTab: Always
# VerilogBreakBetweenInstancePorts: true
# WhitespaceSensitiveMacros: # WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE # - BOOST_PP_STRINGIZE
# - NS_SWIFT_NAME
# - CF_SWIFT_NAME # - CF_SWIFT_NAME
--- # - NS_SWIFT_NAME
### C++ specific config ### # - PP_STRINGIZE
Language: Cpp # - STRINGIZE
Standard: c++17
---
### ObjC specific config ###
Language: ObjC
# ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
---
### Java specific config ###
Language: Java
# BreakAfterJavaFieldAnnotations: false
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']
...

View File

@ -9,7 +9,7 @@ exclude: |
repos: repos:
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6 rev: v18.1.8
hooks: hooks:
- id: clang-format - id: clang-format
files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$ files: \.(c|h|cpp|hpp|cc|hh|cxx|hxx|m|mm|inc|java|glsl)$