add more global default checks

Test: make with and without WITH_TIDY=1
Change-Id: Iee07707158f7204e961970ba4d518403b3b2aaf3
This commit is contained in:
Chih-Hung Hsieh 2021-01-14 16:51:49 -08:00
parent 1b4934a215
commit 34850d350e
1 changed files with 30 additions and 8 deletions

View File

@ -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-*
}, ",")
})