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

Unified Diff: chrome/browser/web_dev_style/js_checker.py

Issue 410603002: web_dev_style: add presubmit for superfluous </include> tags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 5 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 | « chrome/browser/test_presubmit.py ('k') | chrome/browser/web_dev_style/regex_check.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_dev_style/js_checker.py
diff --git a/chrome/browser/web_dev_style/js_checker.py b/chrome/browser/web_dev_style/js_checker.py
index 0e224aa84651ff31f2d43d225ccfcf192b6d61ac..b928aa5d2f0533892871408fb1210e9919bae047 100644
--- a/chrome/browser/web_dev_style/js_checker.py
+++ b/chrome/browser/web_dev_style/js_checker.py
@@ -7,6 +7,9 @@
See chrome/browser/PRESUBMIT.py
"""
+import regex_check
+
+
class JSChecker(object):
def __init__(self, input_api, output_api, file_filter=None):
self.input_api = input_api
@@ -14,27 +17,8 @@ class JSChecker(object):
self.file_filter = file_filter
def RegexCheck(self, line_number, line, regex, message):
- """Searches for |regex| in |line| to check for a particular style
- violation, returning a message like the one below if the regex matches.
- The |regex| must have exactly one capturing group so that the relevant
- part of |line| can be highlighted. If more groups are needed, use
- "(?:...)" to make a non-capturing group. Sample message:
-
- line 6: Use var instead of const.
- const foo = bar();
- ^^^^^
- """
- match = self.input_api.re.search(regex, line)
- if match:
- assert len(match.groups()) == 1
- start = match.start(1)
- length = match.end(1) - start
- return ' line %d: %s\n%s\n%s' % (
- line_number,
- message,
- line,
- self.error_highlight(start, length))
- return ''
+ return regex_check.RegexCheck(
+ self.input_api.re, line_number, line, regex, message)
def ChromeSendCheck(self, i, line):
"""Checks for a particular misuse of 'chrome.send'."""
« no previous file with comments | « chrome/browser/test_presubmit.py ('k') | chrome/browser/web_dev_style/regex_check.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698