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

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: 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
Index: chrome/common/extensions/PRESUBMIT.py
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py
index 2a8f7bc2fa2f947752b97f63aa0dbfe5e9c13d09..05e2cae57d8d496045dfbb3f971e7f1d167a9bc2 100644
--- a/chrome/common/extensions/PRESUBMIT.py
+++ b/chrome/common/extensions/PRESUBMIT.py
@@ -73,8 +73,24 @@ 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.extend(
+ output_api.PresubmitError('File %s needs an id for each heading.' % name)
+ for name in _CheckHeadingIDs(input_api))
not at google - send to devlin 2012/09/26 01:57:17 just assign into results straight away?
cduvall 2012/09/27 23:39:39 Done.
try:
integration_test = []
# From depot_tools/presubmit_canned_checks.py:529

Powered by Google App Engine
This is Rietveld 408576698