Skip to content

Commit 6bfcd6d

Browse files
authored
refactor(style): Change some style options (#9526)
* refactor(style): Change some style options * refactor(style): Apply style changes
1 parent 8cab8c9 commit 6bfcd6d

File tree

702 files changed

+13913
-16460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

702 files changed

+13913
-16460
lines changed

.clang-format

+122-66
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,69 @@
1-
# Source: https://github.com/arduino/tooling-project-assets/tree/main/other/clang-format-configuration
1+
# Clang format version: 18.1.3
22
---
3+
BasedOnStyle: LLVM
34
AccessModifierOffset: -2
4-
AlignAfterOpenBracket: Align
5+
AlignAfterOpenBracket: BlockIndent
56
AlignArrayOfStructures: None
6-
AlignConsecutiveAssignments: None
7-
AlignConsecutiveBitFields: None
8-
AlignConsecutiveDeclarations: None
9-
AlignConsecutiveMacros: None
10-
AlignEscapedNewlines: DontAlign
7+
AlignConsecutiveAssignments:
8+
Enabled: false
9+
AcrossEmptyLines: false
10+
AcrossComments: false
11+
AlignCompound: false
12+
AlignFunctionPointers: false
13+
PadOperators: true
14+
AlignConsecutiveBitFields:
15+
Enabled: true
16+
AcrossEmptyLines: false
17+
AcrossComments: false
18+
AlignCompound: false
19+
AlignFunctionPointers: false
20+
PadOperators: false
21+
AlignConsecutiveDeclarations:
22+
Enabled: false
23+
AcrossEmptyLines: false
24+
AcrossComments: false
25+
AlignCompound: false
26+
AlignFunctionPointers: false
27+
PadOperators: false
28+
AlignConsecutiveMacros:
29+
Enabled: true
30+
AcrossEmptyLines: false
31+
AcrossComments: false
32+
AlignCompound: false
33+
AlignFunctionPointers: false
34+
PadOperators: false
35+
AlignConsecutiveShortCaseStatements:
36+
Enabled: true
37+
AcrossEmptyLines: false
38+
AcrossComments: false
39+
AlignCaseColons: false
40+
AlignEscapedNewlines: Left
1141
AlignOperands: Align
12-
AlignTrailingComments: true
42+
AlignTrailingComments:
43+
Kind: Always
44+
OverEmptyLines: 0
1345
AllowAllArgumentsOnNextLine: true
14-
AllowAllConstructorInitializersOnNextLine: true
1546
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortBlocksOnASingleLine: Always
47+
AllowBreakBeforeNoexceptSpecifier: Never
48+
AllowShortBlocksOnASingleLine: Empty
1749
AllowShortCaseLabelsOnASingleLine: true
18-
AllowShortEnumsOnASingleLine: true
50+
AllowShortCompoundRequirementOnASingleLine: true
51+
AllowShortEnumsOnASingleLine: false
1952
AllowShortFunctionsOnASingleLine: Empty
20-
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
53+
AllowShortIfStatementsOnASingleLine: Never
2154
AllowShortLambdasOnASingleLine: Empty
2255
AllowShortLoopsOnASingleLine: true
2356
AlwaysBreakAfterDefinitionReturnType: None
2457
AlwaysBreakAfterReturnType: None
2558
AlwaysBreakBeforeMultilineStrings: false
26-
AlwaysBreakTemplateDeclarations: No
59+
AlwaysBreakTemplateDeclarations: MultiLine
2760
AttributeMacros:
2861
- __capability
29-
BasedOnStyle: LLVM
3062
BinPackArguments: true
3163
BinPackParameters: true
3264
BitFieldColonSpacing: Both
3365
BraceWrapping:
34-
AfterCaseLabel: false
66+
AfterCaseLabel: true
3567
AfterClass: false
3668
AfterControlStatement: Never
3769
AfterEnum: false
@@ -46,33 +78,33 @@ BraceWrapping:
4678
BeforeLambdaBody: false
4779
BeforeWhile: false
4880
IndentBraces: false
49-
SplitEmptyFunction: true
81+
SplitEmptyFunction: false
5082
SplitEmptyRecord: true
5183
SplitEmptyNamespace: true
84+
BreakAdjacentStringLiterals: true
85+
BreakAfterAttributes: Always
5286
BreakAfterJavaFieldAnnotations: false
87+
BreakArrays: false
5388
BreakBeforeBinaryOperators: NonAssignment
54-
BreakBeforeBraces: Attach
55-
BreakBeforeConceptDeclarations: false
56-
BreakBeforeInheritanceComma: false
89+
BreakBeforeBraces: Custom
90+
BreakBeforeConceptDeclarations: Always
91+
BreakBeforeInlineASMColon: OnlyMultiline
5792
BreakBeforeTernaryOperators: true
5893
BreakConstructorInitializers: BeforeColon
59-
BreakConstructorInitializersBeforeComma: false
6094
BreakInheritanceList: BeforeColon
61-
BreakStringLiterals: false
62-
ColumnLimit: 0
63-
CommentPragmas: ''
95+
BreakStringLiterals: true
96+
ColumnLimit: 160
97+
CommentPragmas: ""
6498
CompactNamespaces: false
65-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
6699
ConstructorInitializerIndentWidth: 2
67100
ContinuationIndentWidth: 2
68-
Cpp11BracedListStyle: false
69-
DeriveLineEnding: true
70-
DerivePointerAlignment: true
101+
Cpp11BracedListStyle: true
102+
DerivePointerAlignment: false
71103
DisableFormat: false
72-
EmptyLineAfterAccessModifier: Leave
73-
EmptyLineBeforeAccessModifier: Leave
104+
EmptyLineAfterAccessModifier: Never
105+
EmptyLineBeforeAccessModifier: LogicalBlock
74106
ExperimentalAutoDetectBinPacking: false
75-
FixNamespaceComments: false
107+
FixNamespaceComments: true
76108
ForEachMacros:
77109
- foreach
78110
- Q_FOREACH
@@ -81,38 +113,49 @@ IfMacros:
81113
- KJ_IF_MAYBE
82114
IncludeBlocks: Preserve
83115
IncludeCategories:
84-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
116+
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
85117
Priority: 2
86118
SortPriority: 0
87119
CaseSensitive: false
88-
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
120+
- Regex: ^(<|"(gtest|gmock|isl|json)/)
89121
Priority: 3
90122
SortPriority: 0
91123
CaseSensitive: false
92-
- Regex: '.*'
124+
- Regex: .*
93125
Priority: 1
94126
SortPriority: 0
95127
CaseSensitive: false
96-
IncludeIsMainRegex: ''
97-
IncludeIsMainSourceRegex: ''
128+
IncludeIsMainRegex: ""
129+
IncludeIsMainSourceRegex: ""
98130
IndentAccessModifiers: false
99-
IndentCaseBlocks: true
131+
IndentCaseBlocks: false
100132
IndentCaseLabels: true
101-
IndentExternBlock: Indent
133+
IndentExternBlock: NoIndent
102134
IndentGotoLabels: false
103135
IndentPPDirectives: None
104-
IndentRequires: true
136+
IndentRequiresClause: false
105137
IndentWidth: 2
106-
IndentWrappedFunctionNames: false
138+
IndentWrappedFunctionNames: true
139+
InsertBraces: true
140+
InsertNewlineAtEOF: true
107141
InsertTrailingCommas: None
142+
IntegerLiteralSeparator:
143+
Binary: 0
144+
BinaryMinDigits: 0
145+
Decimal: 0
146+
DecimalMinDigits: 0
147+
Hex: 0
148+
HexMinDigits: 0
108149
JavaScriptQuotes: Leave
109150
JavaScriptWrapImports: true
151+
KeepEmptyLinesAtEOF: false
110152
KeepEmptyLinesAtTheStartOfBlocks: true
111153
LambdaBodyIndentation: Signature
112154
Language: Cpp
113-
MacroBlockBegin: ''
114-
MacroBlockEnd: ''
115-
MaxEmptyLinesToKeep: 100000
155+
LineEnding: LF
156+
MacroBlockBegin: ""
157+
MacroBlockEnd: ""
158+
MaxEmptyLinesToKeep: 1
116159
NamespaceIndentation: None
117160
ObjCBinPackProtocolList: Auto
118161
ObjCBlockIndentWidth: 2
@@ -121,26 +164,32 @@ ObjCSpaceAfterProperty: false
121164
ObjCSpaceBeforeProtocolList: true
122165
PPIndentWidth: -1
123166
PackConstructorInitializers: BinPack
124-
PenaltyBreakAssignment: 1
125-
PenaltyBreakBeforeFirstCallParameter: 1
126-
PenaltyBreakComment: 1
127-
PenaltyBreakFirstLessLess: 1
128-
PenaltyBreakOpenParenthesis: 1
129-
PenaltyBreakString: 1
130-
PenaltyBreakTemplateDeclaration: 1
131-
PenaltyExcessCharacter: 1
132-
PenaltyIndentedWhitespace: 1
133-
PenaltyReturnTypeOnItsOwnLine: 1
167+
PenaltyBreakAssignment: 2
168+
PenaltyBreakBeforeFirstCallParameter: 19
169+
PenaltyBreakComment: 300
170+
PenaltyBreakFirstLessLess: 120
171+
PenaltyBreakOpenParenthesis: 0
172+
PenaltyBreakScopeResolution: 500
173+
PenaltyBreakString: 1000
174+
PenaltyBreakTemplateDeclaration: 10
175+
PenaltyExcessCharacter: 1000000
176+
PenaltyIndentedWhitespace: 0
177+
PenaltyReturnTypeOnItsOwnLine: 60
134178
PointerAlignment: Right
135179
QualifierAlignment: Leave
136180
ReferenceAlignment: Pointer
137181
ReflowComments: false
138182
RemoveBracesLLVM: false
183+
RemoveParentheses: Leave
184+
RemoveSemicolon: false
185+
RequiresClausePosition: OwnLine
186+
RequiresExpressionIndentation: OuterScope
139187
SeparateDefinitionBlocks: Leave
140-
ShortNamespaceLines: 0
188+
ShortNamespaceLines: 1
189+
SkipMacroDefinitionBody: false
141190
SortIncludes: Never
142191
SortJavaStaticImport: Before
143-
SortUsingDeclarations: false
192+
SortUsingDeclarations: LexicographicNumeric
144193
SpaceAfterCStyleCast: false
145194
SpaceAfterLogicalNot: false
146195
SpaceAfterTemplateKeyword: false
@@ -150,28 +199,34 @@ SpaceBeforeCaseColon: false
150199
SpaceBeforeCpp11BracedList: false
151200
SpaceBeforeCtorInitializerColon: true
152201
SpaceBeforeInheritanceColon: true
202+
SpaceBeforeJsonColon: false
153203
SpaceBeforeParens: ControlStatements
154204
SpaceBeforeParensOptions:
155205
AfterControlStatements: true
156206
AfterForeachMacros: true
157-
AfterFunctionDefinitionName: false
158207
AfterFunctionDeclarationName: false
208+
AfterFunctionDefinitionName: false
159209
AfterIfMacros: true
160-
AfterOverloadedOperator: false
210+
AfterOverloadedOperator: true
211+
AfterPlacementOperator: true
212+
AfterRequiresInClause: false
213+
AfterRequiresInExpression: false
161214
BeforeNonEmptyParentheses: false
162215
SpaceBeforeRangeBasedForLoopColon: true
163216
SpaceBeforeSquareBrackets: false
164217
SpaceInEmptyBlock: false
165-
SpaceInEmptyParentheses: false
166218
SpacesBeforeTrailingComments: 2
167-
SpacesInAngles: Leave
168-
SpacesInCStyleCastParentheses: false
169-
SpacesInConditionalStatement: false
219+
SpacesInAngles: Never
170220
SpacesInContainerLiterals: false
171221
SpacesInLineCommentPrefix:
172-
Minimum: 0
222+
Minimum: 1
173223
Maximum: -1
174-
SpacesInParentheses: false
224+
SpacesInParens: Never
225+
SpacesInParensOptions:
226+
InConditionalStatements: false
227+
InCStyleCasts: false
228+
InEmptyParentheses: false
229+
Other: false
175230
SpacesInSquareBrackets: false
176231
Standard: Auto
177232
StatementAttributeLikeMacros:
@@ -180,11 +235,12 @@ StatementMacros:
180235
- Q_UNUSED
181236
- QT_REQUIRE_VERSION
182237
TabWidth: 2
183-
UseCRLF: false
184238
UseTab: Never
239+
VerilogBreakBetweenInstancePorts: true
185240
WhitespaceSensitiveMacros:
186-
- STRINGIZE
187-
- PP_STRINGIZE
188241
- BOOST_PP_STRINGIZE
189-
- NS_SWIFT_NAME
190242
- CF_SWIFT_NAME
243+
- NS_SWIFT_NAME
244+
- PP_STRINGIZE
245+
- STRINGIZE
246+
BracedInitializerIndentWidth: 2

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ repos:
2626
exclude: ^.*\.(svd|SVD)$
2727
stages: [manual]
2828
- repo: https://github.com/pre-commit/mirrors-clang-format
29-
rev: "v15.0.7"
29+
rev: "v18.1.3"
3030
hooks:
3131
- id: clang-format
3232
types_or: [c, c++]

0 commit comments

Comments
 (0)