Skip to content

Commit

Permalink
Merge pull request #54 from KIT-MRT/add_clang_config
Browse files Browse the repository at this point in the history
Add clang-format and clang-tidy config, export compile commands
  • Loading branch information
ll-nick authored Oct 14, 2024
2 parents a951150 + a13168c commit 7396085
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\/.*\/.*>'
Priority: 3
- Regex: '^<.*\/.*>'
Priority: 2
- Regex: '^<.*>'
Priority: 1
- Regex: '^".*\/.*\/.*"'
Priority: 6
- Regex: '^".*\/.*"'
Priority: 5
- Regex: '^".*"'
Priority: 4
- Regex: '.*'
Priority: 7
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 2000
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
UseTab: Never
169 changes: 169 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
Checks: >
-*,
bugprone-*,
clang-analyzer-apiModeling*,
clang-analyzer-core*,clang-analyzer-deadcode*,
clang-analyzer-unix*,clang-analyzer-cplusplus*,
cppcoreguidelines-*,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-init-variables,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-casting,
google-readability-namespace-comments,
google-runtime-int,
google-global-names-in-headers,
google-build-namespaces,
performance-*,
readability-*,
-readability-uppercase-literal-suffix,
-readability-magic-numbers,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,
-modernize-concat-nested-namespaces,
misc-*,
-misc-non-private-member-variables-in-classes
CheckOptions:
##############
### Google ###
##############
- key: google-readability-braces-around-statements.ShortStatementLines
value: '0'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '0'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '1'

######################
### Function Sizes ###
######################
- key: readability-function-size.BranchThreshold
value: '20'
- key: readability-function-size.LineThreshold
value: '50'
- key: readability-function-size.NestingThreshold
value: '4'
- key: readability-function-size.StatementThreshold
value: '400'

#########################################
### Throw-By-Value-Catch-By-Reference ###
#########################################
- key: misc-throw-by-value-catch-by-reference.CheckThrowTemporaries
value: '0'
- key: readability-identifier-naming.IgnoreFailedSplit
value: '0'

##########################################
### Identifier Naming Check: CamelCase ###
##########################################
- key: readability-identifier-naming.AbstractClassCase
value: CamelCase
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ConstantCase
value: camelBack
- key: readability-identifier-naming.GlobalConstantCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TemplateTemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TemplateTemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TypeTemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.TypeTemplateParameterSuffix
value: ''
- key: readability-identifier-naming.TypedefCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.ValueTemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: CamelCase
- key: readability-identifier-naming.TypeAliasCase
value: CamelCase

##########################################
### Identifier Naming Check: camelBack ###
##########################################
- key: readability-identifier-naming.ClassConstantCase
value: camelBack
- key: readability-identifier-naming.ClassMemberCase
value: camelBack
- key: readability-identifier-naming.ClassMethodCase
value: camelBack
- key: readability-identifier-naming.ConstexprFunctionCase
value: camelBack
- key: readability-identifier-naming.ConstantMemberCase
value: camelBack
- key: readability-identifier-naming.ConstexprMethodCase
value: camelBack
- key: readability-identifier-naming.ConstantParameterCase
value: camelBack
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.GlobalFunctionCase
value: camelBack
- key: readability-identifier-naming.GlobalVariableCase
value: camelBack
- key: readability-identifier-naming.LocalConstantCase
value: camelBack
- key: readability-identifier-naming.LocalVariableCase
value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.MethodCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.ParameterPackCase
value: camelBack
- key: readability-identifier-naming.PrivateMemberCase
value: camelBack
- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
- key: readability-identifier-naming.PrivateMethodCase
value: camelBack
- key: readability-identifier-naming.ProtectedMemberCase
value: camelBack
- key: readability-identifier-naming.ProtectedMethodCase
value: camelBack
- key: readability-identifier-naming.PublicMemberCase
value: camelBack
- key: readability-identifier-naming.PublicMethodCase
value: camelBack
- key: readability-identifier-naming.StaticVariableCase
value: camelBack
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.VirtualMethodCase
value: camelBack

###########################################
### Identifier Naming Check: lower_case ###
###########################################
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.InlineNamespaceCase
value: lower_case
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(arbitration_graphs)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

###################
## Find packages ##
Expand Down

0 comments on commit 7396085

Please sign in to comment.