From f3efde5e7292248a6cae4a0e433dcefc1aef48f6 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 5 May 2022 14:46:34 -0700 Subject: [PATCH] Add ALLOW_LOCAL_TIDY_TRUE Bug: 229779921 Test: presubmit Change-Id: I9ee65fbb96fc68a949e33b63b83d0609696d76a1 --- docs/tidy.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/tidy.md b/docs/tidy.md index 890c3a036..2eb8234c7 100644 --- a/docs/tidy.md +++ b/docs/tidy.md @@ -31,7 +31,7 @@ The default global clang-tidy checks and flags are defined in The global default can be overwritten by module properties in Android.bp. -### `tidy` and `tidy_checks` +### `tidy`, `tidy_checks`, and `ALLOW_LOCAL_TIDY_TRUE` For example, in [system/bpf/Android.bp](https://android.googlesource.com/platform/system/bpf/+/refs/heads/master/Android.bp), @@ -52,8 +52,16 @@ cc_defaults { } ``` That means in normal builds, even without `WITH_TIDY=1`, -the modules that use `bpf_defaults` will run clang-tidy +the modules that use `bpf_defaults` _should_ run clang-tidy over C/C++ source files with the given `tidy_checks`. + +However since clang-tidy warnings and its runtime cost might +not be wanted by all people, the default is to ignore the +`tidy:true` property unless the environment variable +`ALLOW_LOCAL_TIDY_TRUE` is set to true or 1. +To run clang-tidy on all modules that should be tested with clang-tidy, +`ALLOW_LOCAL_TIDY_TRUE` or `WITH_TIDY` should be set to true or 1. + Note that `clang-analyzer-security*` is included in `tidy_checks` but not all `clang-analyzer-*` checks. Check `cert-err34-c` is disabled, although `cert-*` is selected. @@ -80,6 +88,9 @@ cc_test_library { } ``` +Note that `tidy:false` always disables clang-tidy, no matter +`ALLOW_LOCAL_TIDY_TRUE` is set or not. + ### `tidy_checks_as_errors` The global tidy checks are enabled as warnings.