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

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

Issue 2091903002: [Presubmit] check for single quotes in html properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/browser/web_dev_style/html_checker.py
diff --git a/chrome/browser/web_dev_style/html_checker.py b/chrome/browser/web_dev_style/html_checker.py
index 422b7852185410a6f833185faee07bc96a269034..bd842e278288a9729991f61cbf346907f9276cdd 100644
--- a/chrome/browser/web_dev_style/html_checker.py
+++ b/chrome/browser/web_dev_style/html_checker.py
@@ -44,6 +44,17 @@ class HtmlChecker(object):
return regex_check.RegexCheck(self.input_api.re, line_number, line, regex,
'Use the button element instead of <input type="button">')
+ def DoNotUseSingleQuotesCheck(self, line_number, line):
+ regex = self.input_api.re.compile("""
+ (<\s*\w* # The tag name.
+ (?:\s+\w+="[^"]*")* # There may be some correctly quoted (foo="bar").
+ \s+\w+='[^']*' # Find incorrectly quoted (foo='bar').
+ [^>]*>) # To the end of the tag.
+ """,
+ self.input_api.re.VERBOSE)
+ return regex_check.RegexCheck(self.input_api.re, line_number, line, regex,
+ 'Use double quotes rather than single quotes in HTML properties')
+
def I18nContentJavaScriptCaseCheck(self, line_number, line):
regex = self.input_api.re.compile("""
(?:^|\s) # start of line or whitespace
« no previous file with comments | « no previous file | chrome/browser/web_dev_style/html_checker_test.py » ('j') | chrome/browser/web_dev_style/html_checker_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698