Skip to content

Commit

Permalink
Merge pull request #332 from furudbat/feature/clang-format
Browse files Browse the repository at this point in the history
Add Code Formatting (#331)
  • Loading branch information
RobLoach authored Aug 31, 2024
2 parents 4c3e25c + 21187d2 commit 09b029d
Show file tree
Hide file tree
Showing 51 changed files with 1,798 additions and 2,050 deletions.
163 changes: 163 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AllowAllArgumentsOnNextLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: true
## @TODO: when update to clang-format 19, use BreakTemplateDeclarations
#BreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: false
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: Never
EmptyLineAfterAccessModifier: Never
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
PPIndentWidth: 2
QualifierAlignment: Leave
ReferenceAlignment: Left
ReflowComments: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: false
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
LineEnding: LF
UseTab: Never
CommentPragmas: "\/*(.*)*\/"
PackConstructorInitializers: CurrentLine
FixNamespaceComments: true
# Include settings
IncludeBlocks: Preserve
IncludeCategories:
# Main Module Header automatically gets a priority of 0
# Local/Private Headers
- Regex: '^"[^\/"]*"$'
Priority: 200
# Project/subproject headers
- Regex: '^"[^"]*"$'
Priority: 300
# standard library headers
- Regex: '^<[^>\.\/]+>$'
Priority: 500
# standard library headers - experimental
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 550
- Regex: '^<experimental[^>\.]+>$'
Priority: 600
# third party libraries
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 450
- Regex: '^<[^>]+>$'
Priority: 400
# Everything that didn't match
- Regex: '.*'
Priority: 1000
IncludeIsMainRegex: (Test)?$
SortIncludes: CaseSensitive
# Custom style rules
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
Standard: c++11
---
Language: JavaScript
IndentWidth: 2
ColumnLimit: 100
94 changes: 94 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
Checks: "*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-linuxkernel*,-llvm*,-android-*,
-modernize-use-trailing-return-type,
-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-readability-else-after-return,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-non-private-member-variables-in-classes,
-altera-struct-pack-align,
-altera-unroll-loops,
-altera-id-dependent-backward-branch,
-readability-identifier-length,
readability-identifier-naming,
llvm-include-order,
-llvm-header-guard,
bugprone-*,
cert-*,
modernize-*
-modernize-use-trailing-return-type,
-readability-else-after-return,
-readability-static-accessed-through-instance,
-readability-avoid-const-params-in-decls,
-readability-uppercase-literal-suffix,
-cppcoreguidelines-non-private-member-variables-in-classes,
-misc-non-private-member-variables-in-classes,
*-uppercase-literal-suffix,
"
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle: file

CheckOptions:
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.ScopedEnumConstantCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberCase
value: camelBack
- key: readability-identifier-naming.PrivateMemberCase
value: camelBack
- key: readability-identifier-naming.ProtectedMemberCase
value: camelBack
- key: readability-identifier-naming.PublicMemberCase
value: camelBack
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.ClassConstantCase
value: CamelCase
- key: readability-identifier-naming.ConstexprMethodCase
value: CamelCase
- key: readability-identifier-naming.ClassMethodCase
value: CamelCase
- key: readability-identifier-naming.PublicMethodCase
value: CamelCase
- key: readability-identifier-naming.PrivateMethodCase
value: CamelCase
- key: readability-identifier-naming.ProtectedMethodCase
value: CamelCase
- key: readability-identifier-naming.ConstexprMethodCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.LocalVariableCase
value: camelBack
- key: readability-identifier-naming.ConstantParameterCase
value: camelBack
- key: readability-identifier-naming.ParameterPackCase
value: camelBack
- key: readability-identifier-naming.LocalConstantCase
value: camelBack
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.TypedefCase
value: CamelCase
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TemplateTemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.PrivateMemberPrefix
value: 'm_'
- key: readability-identifier-length.IgnoredVariableNames
value: 'i|j|k|x|y|z'
- key: readability-identifier-length.IgnoredParameterNames
value: 'i|j|k|x|y|z'
Loading

0 comments on commit 09b029d

Please sign in to comment.