# To run clang-tidy from CMake, build ClickHouse with -DENABLE_CLANG_TIDY=1. To show all warnings, it is # recommended to pass "-k0" to Ninja. # Enable all checks + disable selected checks. Feel free to remove disabled checks from below list if # a) the new check is not controversial (this includes many checks in readability-* and google-*) or # b) too noisy (checks with > 100 new warnings are considered noisy, this includes e.g. cppcoreguidelines-*). # TODO Let clang-tidy check headers in further directories # --> HeaderFilterRegex: '^.*/(src|base|programs|utils)/.*(h|hpp)$' HeaderFilterRegex: '^.*/(base)/.*(h|hpp)$' Checks: '*, -abseil-*, -altera-*, -android-*, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-easily-swappable-parameters, -bugprone-exception-escape, -bugprone-implicit-widening-of-multiplication-result, -bugprone-narrowing-conversions, -bugprone-not-null-terminated-result, -bugprone-reserved-identifier, -bugprone-unchecked-optional-access, -cert-dcl16-c, -cert-dcl37-c, -cert-dcl51-cpp, -cert-err58-cpp, -cert-msc32-c, -cert-msc51-cpp, -cert-oop54-cpp, -cert-oop57-cpp, -clang-analyzer-optin.performance.Padding, -clang-analyzer-optin.portability.UnixAPI, -clang-analyzer-security.insecureAPI.bzero, -clang-analyzer-security.insecureAPI.strcpy, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-explicit-virtual-functions, -cppcoreguidelines-init-variables, -cppcoreguidelines-interfaces-global-init, -cppcoreguidelines-macro-usage, -cppcoreguidelines-narrowing-conversions, -cppcoreguidelines-no-malloc, -cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-owning-memory, -cppcoreguidelines-prefer-member-initializer, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-constant-array-index, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-const-cast, -cppcoreguidelines-pro-type-cstyle-cast, -cppcoreguidelines-pro-type-member-init, -cppcoreguidelines-pro-type-reinterpret-cast, -cppcoreguidelines-pro-type-static-cast-downcast, -cppcoreguidelines-pro-type-union-access, -cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-slicing, -cppcoreguidelines-special-member-functions, -darwin-*, -fuchsia-*, -google-build-using-namespace, -google-readability-braces-around-statements, -google-readability-casting, -google-readability-function-size, -google-readability-namespace-comments, -google-readability-todo, -google-upgrade-googletest-case, -hicpp-avoid-c-arrays, -hicpp-avoid-goto, -hicpp-braces-around-statements, -hicpp-explicit-conversions, -hicpp-function-size, -hicpp-member-init, -hicpp-move-const-arg, -hicpp-multiway-paths-covered, -hicpp-named-parameter, -hicpp-no-array-decay, -hicpp-no-assembler, -hicpp-no-malloc, -hicpp-signed-bitwise, -hicpp-special-member-functions, -hicpp-uppercase-literal-suffix, -hicpp-use-auto, -hicpp-use-emplace, -hicpp-vararg, -linuxkernel-*, -llvm-*, -llvmlibc-*, -openmp-*, -misc-const-correctness, -misc-no-recursion, -misc-non-private-member-variables-in-classes, -modernize-avoid-c-arrays, -modernize-concat-nested-namespaces, -modernize-macro-to-enum, -modernize-pass-by-value, -modernize-return-braced-init-list, -modernize-use-auto, -modernize-use-default-member-init, -modernize-use-emplace, -modernize-use-nodiscard, -modernize-use-override, -modernize-use-trailing-return-type, -performance-inefficient-string-concatenation, -performance-no-int-to-ptr, -performance-unnecessary-value-param, -portability-simd-intrinsics, -readability-braces-around-statements, -readability-else-after-return, -readability-function-cognitive-complexity, -readability-function-size, -readability-identifier-length, -readability-identifier-naming, -readability-implicit-bool-conversion, -readability-isolate-declaration, -readability-magic-numbers, -readability-named-parameter, -readability-redundant-declaration, -readability-simplify-boolean-expr, -readability-static-accessed-through-instance, -readability-suspicious-call-argument, -readability-uppercase-literal-suffix, -readability-use-anyofallof, -zirkon-*, -misc-*, # temporarily disabled due to being too slow # also disable checks in other categories which are aliases of checks in misc-*: # https://releases.llvm.org/15.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html -cert-dcl54-cpp, # alias of misc-new-delete-overloads -hicpp-new-delete-operators, # alias of misc-new-delete-overloads -cert-fio38-c, # alias of misc-non-copyable-objects -cert-dcl03-c, # alias of misc-static-assert -hicpp-static-assert, # alias of misc-static-assert -cert-err09-cpp, # alias of misc-throw-by-value-catch-by-reference -cert-err61-cpp, # alias of misc-throw-by-value-catch-by-reference -cppcoreguidelines-c-copy-assignment-signature, # alias of misc-unconventional-assign-operator -cppcoreguidelines-non-private-member-variables-in-classes, # alias of misc-non-private-member-variables-in-classes ' WarningsAsErrors: '*' # TODO: use dictionary syntax for CheckOptions when minimum clang-tidy level rose to 15 # some-check.SomeOption: 'some value' # instead of # - key: some-check.SomeOption # value: 'some value' CheckOptions: - key: readability-identifier-naming.ClassCase value: CamelCase - key: readability-identifier-naming.EnumCase value: CamelCase - key: readability-identifier-naming.LocalVariableCase value: lower_case - key: readability-identifier-naming.StaticConstantCase value: aNy_CasE - key: readability-identifier-naming.MemberCase value: lower_case - key: readability-identifier-naming.PrivateMemberPrefix value: '' - key: readability-identifier-naming.ProtectedMemberPrefix value: '' - key: readability-identifier-naming.PublicMemberCase value: lower_case - key: readability-identifier-naming.MethodCase value: camelBack - key: readability-identifier-naming.PrivateMethodPrefix value: '' - key: readability-identifier-naming.ProtectedMethodPrefix value: '' - key: readability-identifier-naming.ParameterPackCase value: lower_case - key: readability-identifier-naming.StructCase value: CamelCase - key: readability-identifier-naming.TemplateTemplateParameterCase value: CamelCase - key: readability-identifier-naming.TemplateUsingCase value: lower_case - key: readability-identifier-naming.TypeTemplateParameterCase value: CamelCase - key: readability-identifier-naming.TypedefCase value: CamelCase - key: readability-identifier-naming.UnionCase value: CamelCase - key: readability-identifier-naming.UsingCase value: CamelCase - key: modernize-loop-convert.UseCxx20ReverseRanges value: false - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false # Workaround clang-tidy bug: https://github.com/llvm/llvm-project/issues/46097 - key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp value: expr-type - key: cppcoreguidelines-avoid-do-while.IgnoreMacros value: true