Make "using namespace" a PRESUBMIT error.
Bug: 82078
Change-Id: Ibc9405d903008c5bebf04f558e1b2c42ba5ced4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879997
Reviewed-by: Daniel Cheng <[email protected]>
Commit-Queue: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#709655}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 7221ad6b..a2e82e32 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -500,6 +500,16 @@
False,
(),
),
+ (
+ r'/\busing namespace ',
+ (
+ 'Using directives ("using namespace x") are banned by the Google Style',
+ 'Guide ( http://google.github.io/styleguide/cppguide.html#Namespaces ).',
+ 'Explicitly qualify symbols or use using declarations ("using x::foo").',
+ ),
+ True,
+ [_THIRD_PARTY_EXCEPT_BLINK], # Don't warn in third_party folders.
+ ),
# Make sure that gtest's FRIEND_TEST() macro is not used; the
# FRIEND_TEST_ALL_PREFIXES() macro from base/gtest_prod_util.h should be
# used instead since that allows for FLAKY_ and DISABLED_ prefixes.