Skip to content

Commit

Permalink
Add clang-format and clang-tidy file
Browse files Browse the repository at this point in the history
  • Loading branch information
silabs-bingocth authored Sep 25, 2024
1 parent 255a82a commit 1153f86
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tools/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
BasedOnStyle: LLVM
IndentWidth: 2
TabWidth: 2
UseTab: Never


# General formatting
AccessModifierOffset: -2
MaxEmptyLinesToKeep: 1
# BreakBeforeBraces: Allman

# Line length
ColumnLimit: 80

# Bracing style
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Never
AfterFunction: true
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false

# Use of spaces
SpacesBeforeTrailingComments: 1
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false

# Use of comments
CommentPragmas: "^ IWYU pragma:"

AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: No
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
Cpp11BracedListStyle: true
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: None
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
50 changes: 50 additions & 0 deletions tools/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Checks: >
-*,
readability-identifier-naming,
readability-magic-numbers,
readability-braces-around-statements
WarningsAsErrors: >
readability-identifier-naming,
readability-magic-numbers,
readability-braces-around-statements
HeaderFilterRegex: ''
FormatStyle: none
InheritParentConfig: true
User: user
CheckOptions:
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.GlobalConstantPrefix
value: SL_
- key: readability-identifier-naming.ConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ConstantPrefix
value: SL_
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumConstantPrefix
value: SL_
- key: readability-identifier-naming.EnumCase
value: lower_case
- key: readability-identifier-naming.EnumPrefix
value: sl_
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: 'sli_.*'
- key: readability-identifier-naming.FunctionCase
value: lower_case
- key: readability-identifier-naming.FunctionPrefix
value: 'sl_'
- key: readability-identifier-naming.StructCase
value: lower_case
- key: readability-identifier-naming.StructPrefix
value: 'sl_'
- key: readability-identifier-naming.StructMemberCase
value: lower_case
- key: readability-identifier-naming.TypedefCase
value: lower_case
- key: readability-identifier-naming.TypedefPrefix
value: 'sl_'

0 comments on commit 1153f86

Please sign in to comment.