Skip to content

Commit 09b029d

Browse files
authored
Merge pull request #332 from furudbat/feature/clang-format
Add Code Formatting (#331)
2 parents 4c3e25c + 21187d2 commit 09b029d

Some content is hidden

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

51 files changed

+1798
-2050
lines changed

.clang-format

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: AlwaysBreak
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: false
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: Never
13+
AllowShortCaseLabelsOnASingleLine: true
14+
AllowShortEnumsOnASingleLine: false
15+
AllowShortFunctionsOnASingleLine: Inline
16+
AllowShortIfStatementsOnASingleLine: true
17+
AllowShortLambdasOnASingleLine: All
18+
AllowShortLoopsOnASingleLine: true
19+
AllowAllArgumentsOnNextLine: false
20+
AlwaysBreakAfterDefinitionReturnType: None
21+
AlwaysBreakBeforeMultilineStrings: false
22+
AlwaysBreakAfterReturnType: None
23+
AlwaysBreakTemplateDeclarations: true
24+
## @TODO: when update to clang-format 19, use BreakTemplateDeclarations
25+
#BreakTemplateDeclarations: Yes
26+
BinPackArguments: false
27+
BinPackParameters: false
28+
BraceWrapping:
29+
AfterCaseLabel: true
30+
AfterClass: false
31+
AfterControlStatement: false
32+
AfterEnum: false
33+
AfterFunction: false
34+
AfterNamespace: false
35+
AfterObjCDeclaration: false
36+
AfterStruct: false
37+
AfterUnion: false
38+
AfterExternBlock: false
39+
BeforeCatch: false
40+
BeforeElse: true
41+
BeforeLambdaBody: true
42+
BeforeWhile: true
43+
IndentBraces: false
44+
SplitEmptyFunction: false
45+
SplitEmptyRecord: false
46+
SplitEmptyNamespace: false
47+
BreakBeforeBinaryOperators: None
48+
BreakBeforeBraces: Custom
49+
BreakBeforeConceptDeclarations: false
50+
BreakBeforeInheritanceComma: false
51+
BreakBeforeTernaryOperators: true
52+
BreakConstructorInitializersBeforeComma: true
53+
BreakConstructorInitializers: BeforeColon
54+
BreakStringLiterals: true
55+
ColumnLimit: 120
56+
CompactNamespaces: false
57+
ConstructorInitializerIndentWidth: 4
58+
ContinuationIndentWidth: 4
59+
Cpp11BracedListStyle: true
60+
DeriveLineEnding: true
61+
DerivePointerAlignment: false
62+
DisableFormat: false
63+
EmptyLineBeforeAccessModifier: Never
64+
EmptyLineAfterAccessModifier: Never
65+
ExperimentalAutoDetectBinPacking: false
66+
IndentCaseLabels: true
67+
IndentGotoLabels: true
68+
IndentPPDirectives: None
69+
IndentWidth: 4
70+
IndentWrappedFunctionNames: false
71+
InsertTrailingCommas: None
72+
KeepEmptyLinesAtTheStartOfBlocks: false
73+
LambdaBodyIndentation: Signature
74+
MacroBlockBegin: ''
75+
MacroBlockEnd: ''
76+
MaxEmptyLinesToKeep: 2
77+
NamespaceIndentation: None
78+
ObjCBinPackProtocolList: Auto
79+
ObjCBlockIndentWidth: 4
80+
ObjCBreakBeforeNestedBlockParam: true
81+
ObjCSpaceAfterProperty: true
82+
ObjCSpaceBeforeProtocolList: true
83+
PenaltyBreakBeforeFirstCallParameter: 19
84+
PenaltyBreakComment: 300
85+
PenaltyBreakFirstLessLess: 120
86+
PenaltyBreakString: 1000
87+
PenaltyExcessCharacter: 1000000
88+
PenaltyIndentedWhitespace: 0
89+
PenaltyReturnTypeOnItsOwnLine: 60
90+
PointerAlignment: Left
91+
PPIndentWidth: 2
92+
QualifierAlignment: Leave
93+
ReferenceAlignment: Left
94+
ReflowComments: true
95+
SortUsingDeclarations: true
96+
SpaceAfterCStyleCast: false
97+
SpaceAfterLogicalNot: false
98+
SpaceAfterTemplateKeyword: false
99+
SpaceAroundPointerQualifiers: Default
100+
SpaceBeforeAssignmentOperators: true
101+
SpaceBeforeCaseColon: false
102+
SpaceBeforeCpp11BracedList: false
103+
SpaceBeforeCtorInitializerColon: true
104+
SpaceBeforeInheritanceColon: true
105+
SpaceBeforeParens: ControlStatements
106+
SpaceBeforeParensOptions:
107+
AfterControlStatements: true
108+
AfterForeachMacros: false
109+
AfterFunctionDefinitionName: false
110+
AfterFunctionDeclarationName: false
111+
AfterIfMacros: false
112+
SpaceBeforeRangeBasedForLoopColon: true
113+
SpaceInEmptyParentheses: false
114+
SpacesBeforeTrailingComments: 1
115+
SpacesInAngles: false
116+
SpacesInContainerLiterals: false
117+
SpacesInCStyleCastParentheses: false
118+
SpacesInParentheses: false
119+
SpacesInSquareBrackets: false
120+
TabWidth: 4
121+
LineEnding: LF
122+
UseTab: Never
123+
CommentPragmas: "\/*(.*)*\/"
124+
PackConstructorInitializers: CurrentLine
125+
FixNamespaceComments: true
126+
# Include settings
127+
IncludeBlocks: Preserve
128+
IncludeCategories:
129+
# Main Module Header automatically gets a priority of 0
130+
# Local/Private Headers
131+
- Regex: '^"[^\/"]*"$'
132+
Priority: 200
133+
# Project/subproject headers
134+
- Regex: '^"[^"]*"$'
135+
Priority: 300
136+
# standard library headers
137+
- Regex: '^<[^>\.\/]+>$'
138+
Priority: 500
139+
# standard library headers - experimental
140+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
141+
Priority: 550
142+
- Regex: '^<experimental[^>\.]+>$'
143+
Priority: 600
144+
# third party libraries
145+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
146+
Priority: 450
147+
- Regex: '^<[^>]+>$'
148+
Priority: 400
149+
# Everything that didn't match
150+
- Regex: '.*'
151+
Priority: 1000
152+
IncludeIsMainRegex: (Test)?$
153+
SortIncludes: CaseSensitive
154+
# Custom style rules
155+
ForEachMacros:
156+
- foreach
157+
- Q_FOREACH
158+
- BOOST_FOREACH
159+
Standard: c++11
160+
---
161+
Language: JavaScript
162+
IndentWidth: 2
163+
ColumnLimit: 100

.clang-tidy

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
Checks: "*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-linuxkernel*,-llvm*,-android-*,
3+
-modernize-use-trailing-return-type,
4+
-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-readability-else-after-return,
5+
-readability-static-accessed-through-instance,
6+
-readability-avoid-const-params-in-decls,
7+
-cppcoreguidelines-non-private-member-variables-in-classes,
8+
-misc-non-private-member-variables-in-classes,
9+
-altera-struct-pack-align,
10+
-altera-unroll-loops,
11+
-altera-id-dependent-backward-branch,
12+
-readability-identifier-length,
13+
readability-identifier-naming,
14+
llvm-include-order,
15+
-llvm-header-guard,
16+
bugprone-*,
17+
cert-*,
18+
modernize-*
19+
-modernize-use-trailing-return-type,
20+
-readability-else-after-return,
21+
-readability-static-accessed-through-instance,
22+
-readability-avoid-const-params-in-decls,
23+
-readability-uppercase-literal-suffix,
24+
-cppcoreguidelines-non-private-member-variables-in-classes,
25+
-misc-non-private-member-variables-in-classes,
26+
*-uppercase-literal-suffix,
27+
"
28+
WarningsAsErrors: ''
29+
HeaderFilterRegex: ''
30+
FormatStyle: file
31+
32+
CheckOptions:
33+
- key: readability-identifier-naming.NamespaceCase
34+
value: lower_case
35+
- key: readability-identifier-naming.ClassCase
36+
value: CamelCase
37+
- key: readability-identifier-naming.EnumCase
38+
value: CamelCase
39+
- key: readability-identifier-naming.StructCase
40+
value: CamelCase
41+
- key: readability-identifier-naming.EnumConstantCase
42+
value: CamelCase
43+
- key: readability-identifier-naming.ScopedEnumConstantCase
44+
value: CamelCase
45+
- key: readability-identifier-naming.ClassMemberCase
46+
value: camelBack
47+
- key: readability-identifier-naming.PrivateMemberCase
48+
value: camelBack
49+
- key: readability-identifier-naming.ProtectedMemberCase
50+
value: camelBack
51+
- key: readability-identifier-naming.PublicMemberCase
52+
value: camelBack
53+
- key: readability-identifier-naming.StaticConstantCase
54+
value: CamelCase
55+
- key: readability-identifier-naming.ClassConstantCase
56+
value: CamelCase
57+
- key: readability-identifier-naming.ConstexprMethodCase
58+
value: CamelCase
59+
- key: readability-identifier-naming.ClassMethodCase
60+
value: CamelCase
61+
- key: readability-identifier-naming.PublicMethodCase
62+
value: CamelCase
63+
- key: readability-identifier-naming.PrivateMethodCase
64+
value: CamelCase
65+
- key: readability-identifier-naming.ProtectedMethodCase
66+
value: CamelCase
67+
- key: readability-identifier-naming.ConstexprMethodCase
68+
value: CamelCase
69+
- key: readability-identifier-naming.VariableCase
70+
value: camelBack
71+
- key: readability-identifier-naming.LocalVariableCase
72+
value: camelBack
73+
- key: readability-identifier-naming.ConstantParameterCase
74+
value: camelBack
75+
- key: readability-identifier-naming.ParameterPackCase
76+
value: camelBack
77+
- key: readability-identifier-naming.LocalConstantCase
78+
value: camelBack
79+
- key: readability-identifier-naming.ConstexprVariableCase
80+
value: CamelCase
81+
- key: readability-identifier-naming.TypedefCase
82+
value: CamelCase
83+
- key: readability-identifier-naming.TemplateParameterCase
84+
value: CamelCase
85+
- key: readability-identifier-naming.TemplateTemplateParameterCase
86+
value: CamelCase
87+
- key: readability-identifier-naming.MacroDefinitionCase
88+
value: UPPER_CASE
89+
- key: readability-identifier-naming.PrivateMemberPrefix
90+
value: 'm_'
91+
- key: readability-identifier-length.IgnoredVariableNames
92+
value: 'i|j|k|x|y|z'
93+
- key: readability-identifier-length.IgnoredParameterNames
94+
value: 'i|j|k|x|y|z'

0 commit comments

Comments
 (0)