Skip to content

Commit 1d87b28

Browse files
committed
添加format配置文件,更新readme,添加ci来检查并自动格式化代码
1 parent ecd1113 commit 1d87b28

File tree

5 files changed

+421
-11
lines changed

5 files changed

+421
-11
lines changed

.clang-format

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
---
2+
AccessModifierOffset: -2
3+
AlignAfterOpenBracket: Align
4+
AlignArrayOfStructures: Left
5+
AlignConsecutiveAssignments:
6+
Enabled: true
7+
AcrossEmptyLines: false
8+
AcrossComments: false
9+
AlignCompound: true
10+
PadOperators: true
11+
AlignConsecutiveBitFields: Consecutive
12+
AlignConsecutiveDeclarations: AcrossComments
13+
AlignConsecutiveMacros: AcrossComments
14+
AlignEscapedNewlines: Right
15+
AlignOperands: Align
16+
AlignTrailingComments: true
17+
AllowAllArgumentsOnNextLine: true
18+
AllowAllParametersOfDeclarationOnNextLine: true
19+
AllowShortEnumsOnASingleLine: false
20+
AllowShortBlocksOnASingleLine: Always
21+
AllowShortCaseLabelsOnASingleLine: true
22+
AllowShortFunctionsOnASingleLine: Empty
23+
AllowShortLambdasOnASingleLine: All
24+
AllowShortIfStatementsOnASingleLine: Never
25+
AllowShortLoopsOnASingleLine: false
26+
AlwaysBreakAfterDefinitionReturnType: None
27+
AlwaysBreakAfterReturnType: None
28+
AlwaysBreakBeforeMultilineStrings: false
29+
AlwaysBreakTemplateDeclarations: Yes
30+
AttributeMacros:
31+
- __restrict
32+
- __LEAF_ATTR
33+
- __THROW
34+
- __THROWNL
35+
- __NTH
36+
- __NTHNL
37+
- __inline
38+
- __attribute__
39+
- __attribute_malloc__
40+
- __attribute_alloc_size__
41+
- __attribute_alloc_align__
42+
- __attribute_pure__
43+
- __attribute_const__
44+
- __attribute_maybe_unused__
45+
- __attribute_used__
46+
- __attribute_noinline__
47+
- __attribute_deprecated__
48+
- __attribute_deprecated_msg__
49+
- __attribute_format_arg__
50+
- __attribute_format_strfmon__
51+
- __attribute_nonnull__
52+
- __nonnull
53+
- __returns_nonnull
54+
- __attribute_warn_unused_result__
55+
- __wur
56+
- __always_inline
57+
- __attribute_artificial__
58+
- __extern_inline
59+
- __extern_always_inline
60+
- __attribute_nonstring__
61+
- __attribute_copy__
62+
- __attr_access
63+
- __fortified_attr_access
64+
- __attr_access_none
65+
- __attr_dealloc
66+
- __attr_dealloc_free
67+
- __attribute_returns_twice__
68+
BinPackArguments: false
69+
BinPackParameters: false
70+
BraceWrapping:
71+
AfterCaseLabel: false
72+
AfterClass: false
73+
AfterControlStatement: Never
74+
AfterEnum: false
75+
AfterFunction: false
76+
AfterNamespace: false
77+
AfterObjCDeclaration: false
78+
AfterStruct: false
79+
AfterUnion: false
80+
AfterExternBlock: false
81+
BeforeCatch: false
82+
BeforeElse: false
83+
BeforeLambdaBody: false
84+
BeforeWhile: false
85+
IndentBraces: false
86+
SplitEmptyFunction: true
87+
SplitEmptyRecord: true
88+
SplitEmptyNamespace: true
89+
BreakBeforeBinaryOperators: None
90+
BreakBeforeConceptDeclarations: Always
91+
BreakBeforeBraces: Attach
92+
BreakBeforeInheritanceComma: false
93+
BreakInheritanceList: BeforeColon
94+
BreakBeforeTernaryOperators: true
95+
BreakConstructorInitializersBeforeComma: false
96+
BreakConstructorInitializers: BeforeColon
97+
BreakAfterJavaFieldAnnotations: false
98+
BreakStringLiterals: false
99+
ColumnLimit: 120
100+
CommentPragmas: "^ IWYU pragma:"
101+
QualifierAlignment: Leave
102+
CompactNamespaces: false
103+
ConstructorInitializerIndentWidth: 4
104+
ContinuationIndentWidth: 4
105+
Cpp11BracedListStyle: true
106+
DeriveLineEnding: true
107+
DerivePointerAlignment: false
108+
DisableFormat: false
109+
EmptyLineAfterAccessModifier: Never
110+
EmptyLineBeforeAccessModifier: LogicalBlock
111+
ExperimentalAutoDetectBinPacking: false
112+
PackConstructorInitializers: NextLineOnly
113+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
114+
AllowAllConstructorInitializersOnNextLine: true
115+
FixNamespaceComments: true
116+
ForEachMacros:
117+
- foreach
118+
- Q_FOREACH
119+
- BOOST_FOREACH
120+
IfMacros:
121+
- KJ_IF_MAYBE
122+
IncludeBlocks: Preserve
123+
IncludeCategories:
124+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
125+
Priority: 2
126+
SortPriority: 0
127+
CaseSensitive: false
128+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
129+
Priority: 3
130+
SortPriority: 0
131+
CaseSensitive: false
132+
- Regex: ".*"
133+
Priority: 1
134+
SortPriority: 0
135+
CaseSensitive: false
136+
IncludeIsMainRegex: "(Test)?$"
137+
IncludeIsMainSourceRegex: ""
138+
IndentAccessModifiers: false
139+
IndentCaseLabels: false
140+
IndentCaseBlocks: false
141+
IndentGotoLabels: true
142+
IndentPPDirectives: AfterHash
143+
IndentExternBlock: AfterExternBlock
144+
IndentRequires: false
145+
IndentWidth: 4
146+
IndentWrappedFunctionNames: false
147+
InsertBraces: true
148+
InsertTrailingCommas: Wrapped
149+
JavaScriptQuotes: Leave
150+
JavaScriptWrapImports: true
151+
KeepEmptyLinesAtTheStartOfBlocks: false
152+
LambdaBodyIndentation: Signature
153+
MacroBlockBegin: ""
154+
MacroBlockEnd: ""
155+
MaxEmptyLinesToKeep: 1
156+
NamespaceIndentation: None
157+
ObjCBinPackProtocolList: Auto
158+
ObjCBlockIndentWidth: 4
159+
ObjCBreakBeforeNestedBlockParam: true
160+
ObjCSpaceAfterProperty: false
161+
ObjCSpaceBeforeProtocolList: true
162+
PenaltyBreakAssignment: 2
163+
PenaltyBreakBeforeFirstCallParameter: 19
164+
PenaltyBreakComment: 300
165+
PenaltyBreakFirstLessLess: 120
166+
PenaltyBreakOpenParenthesis: 0
167+
PenaltyBreakString: 1000
168+
PenaltyBreakTemplateDeclaration: 10
169+
PenaltyExcessCharacter: 1000000
170+
PenaltyReturnTypeOnItsOwnLine: 60
171+
PenaltyIndentedWhitespace: 0
172+
PointerAlignment: Right
173+
PPIndentWidth: -1
174+
ReferenceAlignment: Pointer
175+
ReflowComments: false
176+
RemoveBracesLLVM: false
177+
SeparateDefinitionBlocks: Leave
178+
ShortNamespaceLines: 1
179+
SortIncludes: CaseSensitive
180+
SortJavaStaticImport: Before
181+
SortUsingDeclarations: LexicographicNumeric
182+
SpaceAfterCStyleCast: false
183+
SpaceAfterLogicalNot: false
184+
SpaceAfterTemplateKeyword: true
185+
SpaceBeforeAssignmentOperators: true
186+
SpaceBeforeCaseColon: false
187+
SpaceBeforeCpp11BracedList: false
188+
SpaceBeforeCtorInitializerColon: true
189+
SpaceBeforeInheritanceColon: true
190+
SpaceBeforeParens: ControlStatements
191+
SpaceBeforeParensOptions:
192+
AfterControlStatements: true
193+
AfterForeachMacros: true
194+
AfterFunctionDefinitionName: false
195+
AfterFunctionDeclarationName: false
196+
AfterIfMacros: true
197+
AfterOverloadedOperator: false
198+
BeforeNonEmptyParentheses: false
199+
SpaceAroundPointerQualifiers: Default
200+
SpaceBeforeRangeBasedForLoopColon: true
201+
SpaceInEmptyBlock: false
202+
SpaceInEmptyParentheses: false
203+
SpacesBeforeTrailingComments: 1
204+
SpacesInAngles: Never
205+
SpacesInConditionalStatement: false
206+
SpacesInContainerLiterals: true
207+
SpacesInCStyleCastParentheses: false
208+
SpacesInLineCommentPrefix:
209+
Minimum: 1
210+
Maximum: -1
211+
SpacesInParentheses: false
212+
SpacesInSquareBrackets: false
213+
SpaceBeforeSquareBrackets: false
214+
BitFieldColonSpacing: Both
215+
Standard: Latest
216+
StatementAttributeLikeMacros:
217+
- Q_EMIT
218+
StatementMacros:
219+
- Q_UNUSED
220+
- QT_REQUIRE_VERSION
221+
TabWidth: 4
222+
UseCRLF: false
223+
UseTab: Never
224+
WhitespaceSensitiveMacros:
225+
- STRINGIZE
226+
- PP_STRINGIZE
227+
- BOOST_PP_STRINGIZE
228+
- NS_SWIFT_NAME
229+
- CF_SWIFT_NAME

0 commit comments

Comments
 (0)