Remove native_client_sdk from the PNG presubmit check
The native_client_sdk directory contains auto-generated documentation that
includes PNGs that are flagged by the presubmit check. These PNGs are not used
by Chrome, so they should be ignored by the check.
BUG=150046
[email protected]
Review URL: https://codereview.chromium.org/802463002
Cr-Commit-Position: refs/heads/master@{#308125}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index c875e48..d63fa4217 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -862,12 +862,17 @@
def _CheckNoAbbreviationInPngFileName(input_api, output_api):
"""Makes sure there are no abbreviations in the name of PNG files.
+ The native_client_sdk directory is excluded because it has auto-generated PNG
+ files for documentation.
"""
- pattern = input_api.re.compile(r'.*_[a-z]_.*\.png$|.*_[a-z]\.png$')
errors = []
- for f in input_api.AffectedFiles(include_deletes=False):
- if pattern.match(f.LocalPath()):
- errors.append(' %s' % f.LocalPath())
+ white_list = (r'.*_[a-z]_.*\.png$|.*_[a-z]\.png$',)
+ black_list = (r'^native_client_sdk[\\\/]',)
+ file_filter = lambda f: input_api.FilterSourceFile(
+ f, white_list=white_list, black_list=black_list)
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ errors.append(' %s' % f.LocalPath())
results = []
if errors: