Skip to content

Commit

Permalink
Set up: clang-format, clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
kononovk committed Mar 27, 2023
1 parent 519004d commit bc2ab39
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
BasedOnStyle: Google
Language: Cpp
Standard: c++17
UseTab: Never
DerivePointerAlignment: false
PointerAlignment: Left
ColumnLimit: 120

AllowShortLambdasOnASingleLine: None
AllowShortFunctionsOnASingleLine: None
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true # if false then enums would be formatted as Allman braces style
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowAllArgumentsOnNextLine: false
LambdaBodyIndentation: Signature
BraceWrapping:
BeforeLambdaBody: true
AlignEscapedNewlines: Right
ContinuationIndentWidth: 2
ConstructorInitializerIndentWidth: 2
AlignAfterOpenBracket: Align

IncludeCategories:
- Regex: '^".*"$' # relative includes
Priority: 10
- Regex: '^<ione\/.*>$' # our library public includes
Priority: 30
- Regex: '^<[[:alpha:]_\/]+>$' # STL
Priority: 40
- Regex: '^<.*\.hpp>$' # our library private includes
Priority: 20
- Regex: '.*' # other libraries (system headers in our case)
Priority: 50
IncludeBlocks: Regroup
IndentPPDirectives: AfterHash
73 changes: 73 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Checks: '*,
-abseil-*,
-altera-*,
-android-*,
-boost-*,
-google-objc-*,
-linuxkernel-*,
-llvmlibc-*,
-mpi-*,
-objc-*,
-openmp-*,
-cert-err58-cpp,
-cppcoreguidelines-pro-type-static-cast-downcast,
-fuchsia-default-arguments-*,
-google-build-using-namespace,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-fuchsia-overloaded-operator,
-cppcoreguidelines-pro-type-union-access,
-hicpp-named-parameter,
-modernize-use-default-member-init,
-readability-named-parameter,
-google-explicit-constructor,
-hicpp-explicit-conversions,
-llvm-header-guard,
-cppcoreguidelines-owning-memory'

WarningsAsErrors: '*'

HeaderFilterRegex: '^<.*\.hpp>$'

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.TypedefCase
value: CamelCase
- key: readability-identifier-naming.TypeAliasCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: CamelCase
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberPrefix
value: _
- key: readability-identifier-naming.GlobalConstantCase
value: CamelCase
- key: readability-identifier-naming.GlobalConstantPrefix
value: k
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantPrefix
value: k
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.ConstexprVariablePrefix
value: k
- key: readability-identifier-naming.TypeTemplateParameterCase
value: CamelCase
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
value: 1
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
value: 1
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1

0 comments on commit bc2ab39

Please sign in to comment.