From 8d66596995c06035d7408ad4f5c37eb76898c18d Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Tue, 2 Mar 2021 19:11:56 +0400 Subject: [PATCH] New .clang-tidy configuration to catch code problems. --- .clang-tidy | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index bd6f85f..0dc85d7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,9 +1,49 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,bugprone-*,cppcoreguidelines-*,clang-analyzer-*,misc-*,performance-*,readability-*-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-readability-function-size,-readability-simplify-boolean-expr,-cppcoreguidelines-pro-type-cstyle-cast,-performance-inefficient-string-concatenation,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index' + +# Exceptions: +# cppcoreguidelines-pro-type-cstyle-cast needed by GTK C casts. +# readability-function-cognitive-complexity needed by UI constructors. +# readability-convert-member-functions-to-static is triggered for many callbacks. + +Checks: > + -abseil-*, + -altera-*, + -android-*, + -boost-*, + bugprone-*, + cert-*, + clang-analyzer-*, + concurrency-*, + cppcoreguidelines-*, + -cppcoreguidelines-pro-type-cstyle-cast, + -darwin-*, + -fuchsia-*, + google-* + hicpp-*, + -linuxkernel-*, + -llvm-*, + -llvmlibc-*, + misc-*, + modernize-*, + -modernize-use-trailing-return-type, + -mpi-*, + -objc-*, + openmp-*, + performance-*, + portability-*, + readability-*, + -readability-convert-member-functions-to-static, + -readability-function-cognitive-complexity, + -zircon-* + WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: true FormatStyle: none + +# Fixits should align pointer to left +DerivePointerAlignment: false +PointerAlignment: Left + CheckOptions: - key: readability-braces-around-statements.ShortStatementLines value: '2' @@ -15,5 +55,7 @@ CheckOptions: value: '1' - key: readability-implicit-bool-cast.AllowConditionalPointerCasts value: '1' + - key: performance-unnecessary-value-param.AllowedTypes + value: 'RefPtr;Ptr$' ...