Skip to content

Commit 9adb096

Browse files
committed
add clang format to the project
1 parent 3b602d8 commit 9adb096

File tree

2 files changed

+289
-0
lines changed

2 files changed

+289
-0
lines changed

.clang-format

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignArrayOfStructures: None
7+
AlignConsecutiveAssignments:
8+
Enabled: false
9+
AcrossEmptyLines: false
10+
AcrossComments: false
11+
AlignCompound: false
12+
AlignFunctionPointers: false
13+
PadOperators: true
14+
AlignConsecutiveBitFields:
15+
Enabled: false
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: false
30+
AcrossEmptyLines: false
31+
AcrossComments: false
32+
AlignCompound: false
33+
AlignFunctionPointers: false
34+
PadOperators: false
35+
AlignConsecutiveShortCaseStatements:
36+
Enabled: false
37+
AcrossEmptyLines: false
38+
AcrossComments: false
39+
AlignCaseColons: false
40+
AlignEscapedNewlines: Left
41+
AlignOperands: Align
42+
AlignTrailingComments:
43+
Kind: Always
44+
OverEmptyLines: 0
45+
AllowAllArgumentsOnNextLine: true
46+
AllowAllParametersOfDeclarationOnNextLine: true
47+
AllowBreakBeforeNoexceptSpecifier: Never
48+
AllowShortBlocksOnASingleLine: Never
49+
AllowShortCaseLabelsOnASingleLine: false
50+
AllowShortCompoundRequirementOnASingleLine: true
51+
AllowShortEnumsOnASingleLine: true
52+
AllowShortFunctionsOnASingleLine: All
53+
AllowShortIfStatementsOnASingleLine: WithoutElse
54+
AllowShortLambdasOnASingleLine: All
55+
AllowShortLoopsOnASingleLine: true
56+
AlwaysBreakAfterDefinitionReturnType: None
57+
AlwaysBreakAfterReturnType: None
58+
AlwaysBreakBeforeMultilineStrings: true
59+
AlwaysBreakTemplateDeclarations: Yes
60+
AttributeMacros:
61+
- __capability
62+
BinPackArguments: true
63+
BinPackParameters: true
64+
BitFieldColonSpacing: Both
65+
BraceWrapping:
66+
AfterCaseLabel: false
67+
AfterClass: false
68+
AfterControlStatement: Never
69+
AfterEnum: false
70+
AfterExternBlock: false
71+
AfterFunction: false
72+
AfterNamespace: false
73+
AfterObjCDeclaration: false
74+
AfterStruct: false
75+
AfterUnion: false
76+
BeforeCatch: false
77+
BeforeElse: false
78+
BeforeLambdaBody: false
79+
BeforeWhile: false
80+
IndentBraces: false
81+
SplitEmptyFunction: true
82+
SplitEmptyRecord: true
83+
SplitEmptyNamespace: true
84+
BreakAdjacentStringLiterals: true
85+
BreakAfterAttributes: Leave
86+
BreakAfterJavaFieldAnnotations: false
87+
BreakArrays: true
88+
BreakBeforeBinaryOperators: None
89+
BreakBeforeConceptDeclarations: Always
90+
BreakBeforeBraces: Attach
91+
BreakBeforeInlineASMColon: OnlyMultiline
92+
BreakBeforeTernaryOperators: true
93+
BreakConstructorInitializers: BeforeColon
94+
BreakInheritanceList: BeforeColon
95+
BreakStringLiterals: true
96+
ColumnLimit: 80
97+
CommentPragmas: '^ IWYU pragma:'
98+
CompactNamespaces: false
99+
ConstructorInitializerIndentWidth: 4
100+
ContinuationIndentWidth: 4
101+
Cpp11BracedListStyle: true
102+
DerivePointerAlignment: true
103+
DisableFormat: false
104+
EmptyLineAfterAccessModifier: Never
105+
EmptyLineBeforeAccessModifier: LogicalBlock
106+
ExperimentalAutoDetectBinPacking: false
107+
FixNamespaceComments: true
108+
ForEachMacros:
109+
- foreach
110+
- Q_FOREACH
111+
- BOOST_FOREACH
112+
IfMacros:
113+
- KJ_IF_MAYBE
114+
IncludeBlocks: Regroup
115+
IncludeCategories:
116+
- Regex: '^<ext/.*\.h>'
117+
Priority: 2
118+
SortPriority: 0
119+
CaseSensitive: false
120+
- Regex: '^<.*\.h>'
121+
Priority: 1
122+
SortPriority: 0
123+
CaseSensitive: false
124+
- Regex: '^<.*'
125+
Priority: 2
126+
SortPriority: 0
127+
CaseSensitive: false
128+
- Regex: '.*'
129+
Priority: 3
130+
SortPriority: 0
131+
CaseSensitive: false
132+
IncludeIsMainRegex: '([-_](test|unittest))?$'
133+
IncludeIsMainSourceRegex: ''
134+
IndentAccessModifiers: false
135+
IndentCaseBlocks: false
136+
IndentCaseLabels: true
137+
IndentExternBlock: AfterExternBlock
138+
IndentGotoLabels: true
139+
IndentPPDirectives: None
140+
IndentRequiresClause: true
141+
IndentWidth: 2
142+
IndentWrappedFunctionNames: false
143+
InsertBraces: false
144+
InsertNewlineAtEOF: false
145+
InsertTrailingCommas: None
146+
IntegerLiteralSeparator:
147+
Binary: 0
148+
BinaryMinDigits: 0
149+
Decimal: 0
150+
DecimalMinDigits: 0
151+
Hex: 0
152+
HexMinDigits: 0
153+
JavaScriptQuotes: Leave
154+
JavaScriptWrapImports: true
155+
KeepEmptyLinesAtTheStartOfBlocks: false
156+
KeepEmptyLinesAtEOF: false
157+
LambdaBodyIndentation: Signature
158+
LineEnding: DeriveLF
159+
MacroBlockBegin: ''
160+
MacroBlockEnd: ''
161+
MaxEmptyLinesToKeep: 1
162+
NamespaceIndentation: None
163+
ObjCBinPackProtocolList: Never
164+
ObjCBlockIndentWidth: 2
165+
ObjCBreakBeforeNestedBlockParam: true
166+
ObjCSpaceAfterProperty: false
167+
ObjCSpaceBeforeProtocolList: true
168+
PackConstructorInitializers: NextLine
169+
PenaltyBreakAssignment: 2
170+
PenaltyBreakBeforeFirstCallParameter: 1
171+
PenaltyBreakComment: 300
172+
PenaltyBreakFirstLessLess: 120
173+
PenaltyBreakOpenParenthesis: 0
174+
PenaltyBreakScopeResolution: 500
175+
PenaltyBreakString: 1000
176+
PenaltyBreakTemplateDeclaration: 10
177+
PenaltyExcessCharacter: 1000000
178+
PenaltyIndentedWhitespace: 0
179+
PenaltyReturnTypeOnItsOwnLine: 200
180+
PointerAlignment: Left
181+
PPIndentWidth: -1
182+
QualifierAlignment: Leave
183+
RawStringFormats:
184+
- Language: Cpp
185+
Delimiters:
186+
- cc
187+
- CC
188+
- cpp
189+
- Cpp
190+
- CPP
191+
- 'c++'
192+
- 'C++'
193+
CanonicalDelimiter: ''
194+
BasedOnStyle: google
195+
- Language: TextProto
196+
Delimiters:
197+
- pb
198+
- PB
199+
- proto
200+
- PROTO
201+
EnclosingFunctions:
202+
- EqualsProto
203+
- EquivToProto
204+
- PARSE_PARTIAL_TEXT_PROTO
205+
- PARSE_TEST_PROTO
206+
- PARSE_TEXT_PROTO
207+
- ParseTextOrDie
208+
- ParseTextProtoOrDie
209+
- ParseTestProto
210+
- ParsePartialTestProto
211+
CanonicalDelimiter: pb
212+
BasedOnStyle: google
213+
ReferenceAlignment: Pointer
214+
ReflowComments: true
215+
RemoveBracesLLVM: false
216+
RemoveParentheses: Leave
217+
RemoveSemicolon: false
218+
RequiresClausePosition: OwnLine
219+
RequiresExpressionIndentation: OuterScope
220+
SeparateDefinitionBlocks: Leave
221+
ShortNamespaceLines: 1
222+
SkipMacroDefinitionBody: false
223+
SortIncludes: CaseSensitive
224+
SortJavaStaticImport: Before
225+
SortUsingDeclarations: LexicographicNumeric
226+
SpaceAfterCStyleCast: false
227+
SpaceAfterLogicalNot: false
228+
SpaceAfterTemplateKeyword: true
229+
SpaceAroundPointerQualifiers: Default
230+
SpaceBeforeAssignmentOperators: true
231+
SpaceBeforeCaseColon: false
232+
SpaceBeforeCpp11BracedList: false
233+
SpaceBeforeCtorInitializerColon: true
234+
SpaceBeforeInheritanceColon: true
235+
SpaceBeforeJsonColon: false
236+
SpaceBeforeParens: ControlStatements
237+
SpaceBeforeParensOptions:
238+
AfterControlStatements: true
239+
AfterForeachMacros: true
240+
AfterFunctionDefinitionName: false
241+
AfterFunctionDeclarationName: false
242+
AfterIfMacros: true
243+
AfterOverloadedOperator: false
244+
AfterPlacementOperator: true
245+
AfterRequiresInClause: false
246+
AfterRequiresInExpression: false
247+
BeforeNonEmptyParentheses: false
248+
SpaceBeforeRangeBasedForLoopColon: true
249+
SpaceBeforeSquareBrackets: false
250+
SpaceInEmptyBlock: false
251+
SpacesBeforeTrailingComments: 2
252+
SpacesInAngles: Never
253+
SpacesInContainerLiterals: true
254+
SpacesInLineCommentPrefix:
255+
Minimum: 1
256+
Maximum: -1
257+
SpacesInParens: Never
258+
SpacesInParensOptions:
259+
InCStyleCasts: false
260+
InConditionalStatements: false
261+
InEmptyParentheses: false
262+
Other: false
263+
SpacesInSquareBrackets: false
264+
Standard: Auto
265+
StatementAttributeLikeMacros:
266+
- Q_EMIT
267+
StatementMacros:
268+
- Q_UNUSED
269+
- QT_REQUIRE_VERSION
270+
TabWidth: 8
271+
UseTab: Never
272+
VerilogBreakBetweenInstancePorts: true
273+
WhitespaceSensitiveMacros:
274+
- BOOST_PP_STRINGIZE
275+
- CF_SWIFT_NAME
276+
- NS_SWIFT_NAME
277+
- PP_STRINGIZE
278+
- STRINGIZE
279+
...
280+

.github/workflows/clang-format.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Clang Format Diff Check
2+
on: [push]
3+
jobs:
4+
clang-format-diff-check:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: clang format diff check
8+
run: |
9+
git clang-format-15 --diff main

0 commit comments

Comments
 (0)