From 8b7e2fdfbb176699a76745b970e819001b7e155a Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Thu, 15 Jul 2021 09:08:07 +0200
Subject: [PATCH] clang tool configs

---
 .clang-format | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++
 .clang-tidy   |  96 ++++++++++++++++++++++++++++++++++
 .clangd       |   9 ++++
 3 files changed, 247 insertions(+)
 create mode 100644 .clang-format
 create mode 100644 .clang-tidy
 create mode 100644 .clangd

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..8c1c7ae5
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,142 @@
+Language: Cpp
+Standard: c++20
+
+BasedOnStyle: llvm
+
+PointerAlignment: Left
+
+AccessModifierOffset: -4
+# BreakConstructorInitializers: BeforeComma
+# BreakBeforeParameter: EndsInComma
+#ExperimentalAutoDetectBinPacking: true
+ExperimentalAutoDetectBinPacking: true
+Cpp11BracedListStyle: true
+
+NamespaceIndentation: All
+
+CommentPragmas: "^ q:"
+
+ReflowComments: false
+
+ColumnLimit: 100
+SortIncludes: true
+
+AllowShortEnumsOnASingleLine: false
+
+#BreakBeforeBraces: GNU
+BreakBeforeBraces: Allman
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: true
+
+# AlignConsecutiveAssignments: Consecutive
+
+BinPackArguments: false
+BinPackParameters: false
+
+AllowAllParametersOfDeclarationOnNextLine: false
+
+AllowAllConstructorInitializersOnNextLine: true
+BreakConstructorInitializers: AfterColon
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+
+BreakInheritanceList: AfterColon
+
+# ReturnTypeBreakingStyle: All
+# ReturnTypeBreakingStyle: AllDefinitions
+# BreakTemplateDeclarationsStyle: Yes
+
+# breaks return type
+AlwaysBreakAfterDefinitionReturnType: All
+
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+
+AlwaysBreakTemplateDeclarations: true
+
+BreakBeforeTernaryOperators: true
+
+#ContinuationIndentWidth: 8
+IndentWidth: 4
+#TabWidth: 4
+UseTab: "Never"
+
+AllowAllArgumentsOnNextLine: true
+
+FixNamespaceComments: true
+AlignAfterOpenBracket: Align
+
+IncludeBlocks: Regroup
+
+IncludeCategories:
+  - Regex: "<wykobi.hpp>"
+    Priority: 7
+  - Regex: "^(<cartographer/)"
+    Priority: 8
+  - Regex: "<[[:alnum:,_].]+>"
+    Priority: 3
+  - Regex: "<[[:alnum:,_].]+>"
+    Priority: 3
+  - Regex: "<[[:alnum:].]+>"
+    Priority: 3
+  - Regex: "<[:alnum:]+>"
+    Priority: 3
+  - Regex: "^(<unordered_map>)"
+    Priority: 3
+  - Regex: "^(<type_traits>)"
+    Priority: 3
+  - Regex: "^(<boost/)"
+    Priority: 4
+  - Regex: "^(<Eigen/)"
+    Priority: 5
+  - Regex: "^(<pcl/)"
+    Priority: 6
+  - Regex: "^(<opencv2/)"
+    Priority: 7
+
+  - Regex: "^(<IceUtil/)"
+    Priority: 8
+  - Regex: "^(<Ice/)"
+    Priority: 8
+  - Regex: "^(<VirtualRobot/)"
+    Priority: 10
+  - Regex: "^(<SimoxUtility/)"
+    Priority: 10
+  - Regex: '^((<|")ArmarXCore/)'
+    Priority: 20
+  - Regex: '^((<|")ArmarXGui/)'
+    Priority: 21
+  - Regex: '^((<|")RobotAPI/)'
+    Priority: 22
+  - Regex: '^((<|")VisionX/)'
+    Priority: 23
+  - Regex: '^((<|")RobotComponents/)'
+    Priority: 24
+  - Regex: '^((<|")ArmarXSimulation/)'
+    Priority: 25
+  - Regex: '^((<|")RobotSkillTemplates/)'
+    Priority: 26
+  - Regex: '^((<|")Armar6RT/)'
+    Priority: 27
+  - Regex: '^((<|")Armar6Skills/)'
+    Priority: 28
+  - Regex: '^((<|")Armar6RT/)'
+    Priority: 29
+  - Regex: '^((<|")MobileManipulation/)'
+    Priority: 30
+  - Regex: '^((<|")ROBDEKON/)'
+    Priority: 31
+  # - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+  #   Priority:        2
+  #   SortPriority:    2
+  #   CaseSensitive:   true
+  # - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+  #   Priority:        3
+  # # - Regex:           '^(<|"(Eigen)/)'
+  # #   Priority:        3
+  # - Regex:           '^<VirtualRobot/'
+  #   Priority:        4
+  # - Regex:           '.*'
+  #   Priority:        1
+  #   SortPriority:    0
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 00000000..fc2f7fe9
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,96 @@
+# based on https://github.com/frankaemika/libfranka/blob/master/.clang-tidy
+User: fabian.reister
+Checks: '
+  clang-diagnostic-*,
+  clang-analyzer-*,
+  -clang-analyzer-alpha*,
+  google-*,
+  -google-explicit-constructor,
+  -google-runtime-references,
+  -google-default-arguments,
+  misc-*,
+  -misc-throw-by-value-catch-by-reference,
+  -misc-non-private-member-variables-in-classes,
+  readability-*,
+  -readability-redundant-string-init,
+  modernize-*,
+  -modernize-use-trailing-return-type,
+  -modernize-use-nodiscard,
+  -modernize-pass-by-value,
+  performance-*,
+  cppcoreguidelines-*,
+  -cppcoreguidelines-pro-type-reinterpret-cast,
+  -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+  -cppcoreguidelines-pro-bounds-constant-array-index,
+  -cppcoreguidelines-pro-type-union-access,
+  -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+  -cppcoreguidelines-pro-type-member-init,
+  -cppcoreguidelines-special-member-functions,
+  -cppcoreguidelines-owning-memory
+'
+HeaderFilterRegex: '^.*(source|include).*$'
+CheckOptions:
+  - key:    readability-identifier-naming.NamespaceCase
+    value:  lower_case
+  - key:    readability-identifier-naming.ClassCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.StructCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.EnumCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.UnionCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.TypedefCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.ParameterCase
+    value:  camelBack
+  - key:    readability-identifier-naming.VariableCase
+    value:  camelBack
+  - key:    readability-identifier-naming.MemberCase
+    value:  camelBack
+  - key:    readability-identifier-naming.PublicMemberCase
+    value:  camelBack
+  - key:    readability-identifier-naming.ProtectedMemberCase
+    value:  camelBack
+  - key:    readability-identifier-naming.PrivateMemberCase
+    value:  camelBack
+  - key:    readability-identifier-naming.PrivateMemberSuffix
+    value:  ''
+  - key:    readability-identifier-naming.FunctionCase
+    value:  camelBack
+  - key:    readability-identifier-naming.MethodCase
+    value:  camelBack
+  - key:    readability-identifier-naming.ConstantPrefix
+    value:  ''
+  - key:    readability-identifier-naming.ConstantCase
+    value:  CamelCase
+  - key:    readability-identifier-naming.ConstantMemberPrefix
+    value:  ''
+  - key:    readability-identifier-naming.ConstantMemberCase
+    value:  UPPER_CASE
+  - key:    readability-identifier-naming.ConstantParameterPrefix
+    value:  ''
+  - key:    readability-identifier-naming.ConstantParameterCase
+    value:  camelBack
+  - key:    readability-identifier-naming.LocalConstantParameterPrefix
+    value:  ''
+  - key:    readability-identifier-naming.LocalConstantCase
+    value:  camelBack
+  - key:    readability-identifier-naming.ConstexprVariablePrefix
+    value:  ''
+  - key:    readability-identifier-naming.ConstexprVariableCase
+    value:  camelBack
+  - key:    readabiltiy-identifier-naming.EnumConstantCase
+    value:  CamelCase
+  - key:    readabiltiy-identifier-naming.EnumConstantPrefix
+    value:  ''
+  - key:    readabiltiy-identifier-naming.EnumConstantSuffix
+    value:  ''
+  - key:    readabiltiy-identifier-naming.ClassMemberIgnoredRegexp
+    value:  '*\_T\_*'
+  - key:    readability-identifier-naming.ClassConstantCase
+    value:  UPPER_CASE
+  - key:    readability-identifier-naming.LocalVariableIgnoredRegexp
+    value:  '^.*_[T,R,V]_.*$'
+  - key:    readability-identifier-naming.LocalConstantIgnoredRegexp
+    value:  '^.*_[T,R,V]_.*$'
diff --git a/.clangd b/.clangd
new file mode 100644
index 00000000..fee8b5ff
--- /dev/null
+++ b/.clangd
@@ -0,0 +1,9 @@
+CompileFlags:                     # Tweak the parse settings
+  Add: [-xc++, -Wall]             # treat all files as C++, enable more warnings
+  Remove: -fconcepts                     # strip all other warning-related flags
+Diagnostics:
+  ClangTidy:
+    Remove: cppcoreguidelines-special-member-functions
+HeaderInsertion:
+  Match: <Eigen/src/Geometry/.*>
+  Use: <Eigen/Geometry>
-- 
GitLab