Presubmit: Skip third_party for fwd decl warning
Skip presubmit warning when the introduced useless forward
declaration is made in third_party (with the exception of
blink). Take the opportunity to fix one test and style.
BUG=662195
TEST=PRESUBMIT_test.py ForwardDeclarationTest
Review-Url: https://codereview.chromium.org/2568473002
Cr-Commit-Position: refs/heads/master@{#437833}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 60090e1..da46670 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1586,8 +1586,9 @@
def _CheckUselessForwardDeclarations(input_api, output_api):
- """Checks that added or removed lines in affected header files
- do not lead to new useless class or struct forward declaration.
+ """Checks that added or removed lines in non third party affected
+ header files do not lead to new useless class or struct forward
+ declaration.
"""
results = []
class_pattern = input_api.re.compile(r'^class\s+(\w+);$',
@@ -1595,6 +1596,11 @@
struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$',
input_api.re.MULTILINE)
for f in input_api.AffectedFiles(include_deletes=False):
+ if (f.LocalPath().startswith('third_party') and
+ not f.LocalPath().startswith('third_party/WebKit') and
+ not f.LocalPath().startswith('third_party\\WebKit')):
+ continue
+
if not f.LocalPath().endswith('.h'):
continue