Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: chrome/common/extensions/PRESUBMIT.py

Issue 172573004: Fix PRESUBMIT tests for committed files that are not .md or .html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed reviewer comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/PRESUBMIT.py
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py
index 08ff3a5564d1c6e5d10a6626125877c9d10743ff..0f2636b24f55620c215b12abfb63a63d8a4b6039 100644
--- a/chrome/common/extensions/PRESUBMIT.py
+++ b/chrome/common/extensions/PRESUBMIT.py
@@ -25,6 +25,8 @@ LOCAL_PUBLIC_TEMPLATES_PATH = os.path.join('docs',
'templates',
'public')
+EXTENSIONS_TO_REMOVE_FOR_CLEAN_URLS = ('.md', '.html')
+
def _ReadFile(filename):
with open(filename) as f:
return f.read()
@@ -48,9 +50,13 @@ def _FindMatchingTemplates(template_name, template_path_list):
unix_name = _UnixName(template_name)
for template in template_path_list:
if unix_name == _UnixName(template.split(os.sep)[-1]):
- # The docserver expects clean (extensionless) template URLs, so we strip
- # extensions here when generating the list of matches.
- matches.append(os.path.splitext(template)[0])
+ basename, ext = os.path.splitext(template)
+ # The docserver expects clean (extensionless) template URLs, so we
+ # strip some extensions here when generating the list of matches.
+ if ext in EXTENSIONS_TO_REMOVE_FOR_CLEAN_URLS:
+ matches.append(basename)
+ else:
+ matches.append(template)
return matches
def _SanitizeAPIName(name, api_path):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698