Disable external/grpc-grpc even with TIDY_EXTERNAL_VENDOR=1

Some projects do not allow or fix tidy warnings to
avoid warnings-as-errors. They should not run
clang-tidy even with TIDY_EXTERNAL_VENDOR=1.

Bug: 244631413
Test: presubmit; TIDY_EXTERNAL_VENDOR=1 make tidy-external_subset
Change-Id: Id86a55c222fdad813c1c3434245c86bb97d0cad6
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index 8b5289d..ad205cf 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -205,11 +205,18 @@
 	return tidyDefault
 }
 
-func NoClangTidyForDir(dir string) bool {
+func neverTidyForDir(dir string) bool {
+	// This function can be extended if tidy needs to be disabled for more directories.
+	return strings.HasPrefix(dir, "external/grpc-grpc")
+}
+
+func NoClangTidyForDir(allowExternalVendor bool, dir string) bool {
+	// Tidy can be disable for a module in dir, if the dir is "neverTidyForDir",
+	// or if it belongs to external|vendor and !allowExternalVendor.
 	// This function depends on TidyChecksForDir, which selects tidyExternalVendor
-	// checks for external/vendor projects. For those projects we disable clang-tidy
-	// by default, unless some modules enable clang-tidy with tidy:true.
-	return TidyChecksForDir(dir) == tidyExternalVendor
+	// checks for external/vendor projects.
+	return neverTidyForDir(dir) ||
+		(!allowExternalVendor && TidyChecksForDir(dir) == tidyExternalVendor)
 }
 
 // Returns a globally disabled tidy checks, overriding locally selected checks.