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

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

Issue 10993029: Extensions Docs Server: Fix headings with no IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more descriptive ids Created 8 years, 3 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 | chrome/common/extensions/docs/templates/articles/app_architecture.html » ('j') | 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 2a8f7bc2fa2f947752b97f63aa0dbfe5e9c13d09..e4a2f7e06448e37a51a894301f39e6d5273b0844 100644
--- a/chrome/common/extensions/PRESUBMIT.py
+++ b/chrome/common/extensions/PRESUBMIT.py
@@ -73,8 +73,23 @@ def _CreateIntegrationTestArgs(affected_files):
_ListFilesInPublic()))
return args
+def _CheckHeadingIDs(input_api):
+ ids_re = re.compile('<h[23].*id=.*?>')
+ headings_re = re.compile('<h[23].*?>')
+ bad_files = []
+ for name in input_api.AbsoluteLocalPaths():
+ if (fnmatch.fnmatch(name, '*%s*' % INTROS_PATH) or
+ fnmatch.fnmatch(name, '*%s*' % ARTICLES_PATH)):
+ contents = input_api.ReadFile(name)
+ if (len(re.findall(headings_re, contents)) !=
+ len(re.findall(ids_re, contents))):
+ bad_files.append(name)
+ return bad_files
+
def _CheckChange(input_api, output_api):
- results = []
+ results = [
+ output_api.PresubmitError('File %s needs an id for each heading.' % name)
+ for name in _CheckHeadingIDs(input_api)]
try:
integration_test = []
# From depot_tools/presubmit_canned_checks.py:529
« no previous file with comments | « no previous file | chrome/common/extensions/docs/templates/articles/app_architecture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698