Skip to content
This repository was archived by the owner on Dec 29, 2024. It is now read-only.

Commit 9e7eebb

Browse files
authored
Add clang-format (#118)
1 parent 0006f2e commit 9e7eebb

60 files changed

Lines changed: 3064 additions & 2616 deletions

Some content is hidden

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

.clang-format

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# borrwed from the godot .clang-format
2+
#
3+
# Commented out parameters are those with the same value as base LLVM style.
4+
# We can uncomment them if we want to change their value, or enforce the
5+
# chosen value in case the base style changes (last sync: Clang 14.0).
6+
---
7+
### General config, applies to all languages ###
8+
BasedOnStyle: LLVM
9+
AccessModifierOffset: -4
10+
AlignAfterOpenBracket: DontAlign
11+
# AlignArrayOfStructures: None
12+
# AlignConsecutiveMacros: None
13+
# AlignConsecutiveAssignments: None
14+
# AlignConsecutiveBitFields: None
15+
# AlignConsecutiveDeclarations: None
16+
# AlignEscapedNewlines: Right
17+
AlignOperands: DontAlign
18+
AlignTrailingComments: false
19+
# AllowAllArgumentsOnNextLine: true
20+
AllowAllParametersOfDeclarationOnNextLine: false
21+
# AllowShortEnumsOnASingleLine: true
22+
# AllowShortBlocksOnASingleLine: Never
23+
# AllowShortCaseLabelsOnASingleLine: false
24+
# AllowShortFunctionsOnASingleLine: All
25+
# AllowShortLambdasOnASingleLine: All
26+
# AllowShortIfStatementsOnASingleLine: Never
27+
# AllowShortLoopsOnASingleLine: false
28+
# AlwaysBreakAfterDefinitionReturnType: None
29+
# AlwaysBreakAfterReturnType: None
30+
# AlwaysBreakBeforeMultilineStrings: false
31+
# AlwaysBreakTemplateDeclarations: MultiLine
32+
# AttributeMacros:
33+
# - __capability
34+
# BinPackArguments: true
35+
# BinPackParameters: true
36+
# BraceWrapping:
37+
# AfterCaseLabel: false
38+
# AfterClass: false
39+
# AfterControlStatement: Never
40+
# AfterEnum: false
41+
# AfterFunction: false
42+
# AfterNamespace: false
43+
# AfterObjCDeclaration: false
44+
# AfterStruct: false
45+
# AfterUnion: false
46+
# AfterExternBlock: false
47+
# BeforeCatch: false
48+
# BeforeElse: false
49+
# BeforeLambdaBody: false
50+
# BeforeWhile: false
51+
# IndentBraces: false
52+
# SplitEmptyFunction: true
53+
# SplitEmptyRecord: true
54+
# SplitEmptyNamespace: true
55+
# BreakBeforeBinaryOperators: None
56+
# BreakBeforeConceptDeclarations: true
57+
# BreakBeforeBraces: Attach
58+
# BreakBeforeInheritanceComma: false
59+
# BreakInheritanceList: BeforeColon
60+
# BreakBeforeTernaryOperators: true
61+
# BreakConstructorInitializersBeforeComma: false
62+
BreakConstructorInitializers: AfterColon
63+
# BreakStringLiterals: true
64+
ColumnLimit: 0
65+
# CommentPragmas: '^ IWYU pragma:'
66+
# QualifierAlignment: Leave
67+
# CompactNamespaces: false
68+
ConstructorInitializerIndentWidth: 8
69+
ContinuationIndentWidth: 8
70+
Cpp11BracedListStyle: false
71+
# DeriveLineEnding: true
72+
# DerivePointerAlignment: false
73+
# DisableFormat: false
74+
# EmptyLineAfterAccessModifier: Never
75+
# EmptyLineBeforeAccessModifier: LogicalBlock
76+
# ExperimentalAutoDetectBinPacking: false
77+
# PackConstructorInitializers: BinPack
78+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
79+
# AllowAllConstructorInitializersOnNextLine: true
80+
# FixNamespaceComments: true
81+
# ForEachMacros:
82+
# - foreach
83+
# - Q_FOREACH
84+
# - BOOST_FOREACH
85+
# IfMacros:
86+
# - KJ_IF_MAYBE
87+
# IncludeBlocks: Preserve
88+
IncludeCategories:
89+
- Regex: '".*"'
90+
Priority: 1
91+
- Regex: '^<.*\.h>'
92+
Priority: 2
93+
- Regex: '^<.*'
94+
Priority: 3
95+
# IncludeIsMainRegex: '(Test)?$'
96+
# IncludeIsMainSourceRegex: ''
97+
# IndentAccessModifiers: false
98+
IndentCaseLabels: true
99+
# IndentCaseBlocks: false
100+
# IndentGotoLabels: true
101+
# IndentPPDirectives: None
102+
# IndentExternBlock: AfterExternBlock
103+
# IndentRequires: false
104+
IndentWidth: 4
105+
# IndentWrappedFunctionNames: false
106+
# InsertTrailingCommas: None
107+
# JavaScriptQuotes: Leave
108+
# JavaScriptWrapImports: true
109+
KeepEmptyLinesAtTheStartOfBlocks: false
110+
# LambdaBodyIndentation: Signature
111+
# MacroBlockBegin: ''
112+
# MacroBlockEnd: ''
113+
# MaxEmptyLinesToKeep: 1
114+
# NamespaceIndentation: None
115+
# PenaltyBreakAssignment: 2
116+
# PenaltyBreakBeforeFirstCallParameter: 19
117+
# PenaltyBreakComment: 300
118+
# PenaltyBreakFirstLessLess: 120
119+
# PenaltyBreakOpenParenthesis: 0
120+
# PenaltyBreakString: 1000
121+
# PenaltyBreakTemplateDeclaration: 10
122+
# PenaltyExcessCharacter: 1000000
123+
# PenaltyReturnTypeOnItsOwnLine: 60
124+
# PenaltyIndentedWhitespace: 0
125+
# PointerAlignment: Right
126+
# PPIndentWidth: -1
127+
# ReferenceAlignment: Pointer
128+
# ReflowComments: true
129+
# RemoveBracesLLVM: false
130+
# SeparateDefinitionBlocks: Leave
131+
# ShortNamespaceLines: 1
132+
# SortIncludes: CaseSensitive
133+
# SortJavaStaticImport: Before
134+
# SortUsingDeclarations: true
135+
# SpaceAfterCStyleCast: false
136+
# SpaceAfterLogicalNot: false
137+
# SpaceAfterTemplateKeyword: true
138+
# SpaceBeforeAssignmentOperators: true
139+
# SpaceBeforeCaseColon: false
140+
# SpaceBeforeCpp11BracedList: false
141+
# SpaceBeforeCtorInitializerColon: true
142+
# SpaceBeforeInheritanceColon: true
143+
# SpaceBeforeParens: ControlStatements
144+
# SpaceBeforeParensOptions:
145+
# AfterControlStatements: true
146+
# AfterForeachMacros: true
147+
# AfterFunctionDefinitionName: false
148+
# AfterFunctionDeclarationName: false
149+
# AfterIfMacros: true
150+
# AfterOverloadedOperator: false
151+
# BeforeNonEmptyParentheses: false
152+
# SpaceAroundPointerQualifiers: Default
153+
# SpaceBeforeRangeBasedForLoopColon: true
154+
# SpaceInEmptyBlock: false
155+
# SpaceInEmptyParentheses: false
156+
# SpacesBeforeTrailingComments: 1
157+
# SpacesInAngles: Never
158+
# SpacesInConditionalStatement: false
159+
# SpacesInContainerLiterals: true
160+
# SpacesInCStyleCastParentheses: false
161+
## Godot TODO: We'll want to use a min of 1, but we need to see how to fix
162+
## our comment capitalization at the same time.
163+
SpacesInLineCommentPrefix:
164+
Minimum: 0
165+
Maximum: -1
166+
# SpacesInParentheses: false
167+
# SpacesInSquareBrackets: false
168+
# SpaceBeforeSquareBrackets: false
169+
# BitFieldColonSpacing: Both
170+
# StatementAttributeLikeMacros:
171+
# - Q_EMIT
172+
# StatementMacros:
173+
# - Q_UNUSED
174+
# - QT_REQUIRE_VERSION
175+
TabWidth: 4
176+
# UseCRLF: false
177+
UseTab: Always
178+
# WhitespaceSensitiveMacros:
179+
# - STRINGIZE
180+
# - PP_STRINGIZE
181+
# - BOOST_PP_STRINGIZE
182+
# - NS_SWIFT_NAME
183+
# - CF_SWIFT_NAME
184+
---
185+
### C++ specific config ###
186+
Language: Cpp
187+
Standard: c++17
188+
---
189+
### ObjC specific config ###
190+
Language: ObjC
191+
# ObjCBinPackProtocolList: Auto
192+
ObjCBlockIndentWidth: 4
193+
# ObjCBreakBeforeNestedBlockParam: true
194+
# ObjCSpaceAfterProperty: false
195+
# ObjCSpaceBeforeProtocolList: true
196+
---
197+
### Java specific config ###
198+
Language: Java
199+
# BreakAfterJavaFieldAnnotations: false
200+
JavaImportGroups: ['org.godotengine', 'android', 'androidx', 'com.android', 'com.google', 'java', 'javax']

.clang-tidy

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: ''
5+
AnalyzeTemporaryDtors: false
6+
FormatStyle: none
7+
CheckOptions:
8+
- key: cert-dcl16-c.NewSuffixes
9+
value: 'L;LL;LU;LLU'
10+
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
11+
value: '0'
12+
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
13+
value: '1'
14+
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
15+
value: '1'
16+
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
17+
value: '1'
18+
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
19+
value: '1'
20+
- key: google-readability-function-size.StatementThreshold
21+
value: '800'
22+
- key: google-readability-namespace-comments.ShortNamespaceLines
23+
value: '10'
24+
- key: google-readability-namespace-comments.SpacesBeforeComments
25+
value: '2'
26+
- key: modernize-loop-convert.MaxCopySize
27+
value: '16'
28+
- key: modernize-loop-convert.MinConfidence
29+
value: reasonable
30+
- key: modernize-loop-convert.NamingStyle
31+
value: CamelCase
32+
- key: modernize-pass-by-value.IncludeStyle
33+
value: llvm
34+
- key: modernize-replace-auto-ptr.IncludeStyle
35+
value: llvm
36+
- key: modernize-use-bool-literals.IgnoreMacros
37+
value: '0'
38+
- key: modernize-use-default-member-init.IgnoreMacros
39+
value: '0'
40+
- key: modernize-use-default-member-init.UseAssignment
41+
value: '1'
42+
- key: modernize-use-nullptr.NullMacros
43+
value: 'NULL'
44+
- key: readability-braces-around-statements.ShortStatementLines
45+
value: '0'
46+
...

0 commit comments

Comments
 (0)