From 34850d350ec4802e6c71cb21c2972fc02a0e7306 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 14 Jan 2021 16:51:49 -0800 Subject: [PATCH] add more global default checks Test: make with and without WITH_TIDY=1 Change-Id: Iee07707158f7204e961970ba4d518403b3b2aaf3 --- cc/config/tidy.go | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/cc/config/tidy.go b/cc/config/tidy.go index 4ac9e5863..09479f5e4 100644 --- a/cc/config/tidy.go +++ b/cc/config/tidy.go @@ -20,24 +20,46 @@ import ( ) func init() { - // Most Android source files are not clang-tidy clean yet. - // Global tidy checks include only google*, performance*, - // and misc-macro-parentheses, but not google-readability* - // or google-runtime-references. + // Many clang-tidy checks like altera-*, llvm-*, modernize-* + // are not designed for Android source code or creating too + // many (false-positive) warnings. The global default tidy checks + // should include only tested groups and exclude known noisy checks. + // See https://clang.llvm.org/extra/clang-tidy/checks/list.html pctx.VariableFunc("TidyDefaultGlobalChecks", func(ctx android.PackageVarContext) string { if override := ctx.Config().Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" { return override } return strings.Join([]string{ "-*", - "bugprone*", + "abseil-*", + "android-*", + "bugprone-*", + "cert-*", + "clang-analyzer-*", "clang-diagnostic-unused-command-line-argument", - "google*", - "misc-macro-parentheses", - "performance*", + "google-*", + "misc-*", + "performance-*", + "portability-*", "-bugprone-narrowing-conversions", "-google-readability*", "-google-runtime-references", + "-misc-no-recursion", + "-misc-non-private-member-variables-in-classes", + "-misc-unused-parameters", + // the following groups are excluded by -* + // -altera-* + // -cppcoreguidelines-* + // -darwin-* + // -fuchsia-* + // -hicpp-* + // -llvm-* + // -llvmlibc-* + // -modernize-* + // -mpi-* + // -objc-* + // -readability-* + // -zircon-* }, ",") })