Index: chrome/browser/web_dev_style/html_checker.py |
diff --git a/chrome/browser/web_dev_style/resource_checker.py b/chrome/browser/web_dev_style/html_checker.py |
similarity index 69% |
copy from chrome/browser/web_dev_style/resource_checker.py |
copy to chrome/browser/web_dev_style/html_checker.py |
index 860d88c6c305b11d548c7f4a380ff812aeefb5d0..0addcd71ad623a3b108c4ca47349e640f61312a6 100644 |
--- a/chrome/browser/web_dev_style/resource_checker.py |
+++ b/chrome/browser/web_dev_style/html_checker.py |
@@ -3,21 +3,23 @@ |
# found in the LICENSE file. |
""" |
-Presubmit for Chromium HTML/CSS/JS resources. See chrome/browser/PRESUBMIT.py. |
+Presubmit for Chromium HTML resources. See chrome/browser/PRESUBMIT.py. |
""" |
import regex_check |
-class ResourceChecker(object): |
+class HtmlChecker(object): |
def __init__(self, input_api, output_api, file_filter=None): |
self.input_api = input_api |
self.output_api = output_api |
self.file_filter = file_filter |
- def IncludeCheck(self, line_number, line): |
+ def LabelCheck(self, line_number, line): |
return regex_check.RegexCheck(self.input_api.re, line_number, line, |
- "(</include>)", "</include> is unnecessary. Please remove.") |
+ "(for=)", |
+ "Avoid 'for' attribute on <label>. Place the input within the <label>, " |
+ "or use aria-labelledby for <select>.") |
def RunChecks(self): |
"""Check for violations of the Chromium web development style guide. See |
@@ -31,14 +33,14 @@ class ResourceChecker(object): |
for f in affected_files: |
errors = [] |
- for line_number, line in enumerate(f.NewContents(), start=1): |
- error = self.IncludeCheck(line_number, line) |
+ for line_number, line in f.ChangedContents(): |
+ error = self.LabelCheck(line_number, line) |
if error: |
errors.append(error) |
if errors: |
abs_local_path = f.AbsoluteLocalPath() |
- file_indicator = 'Found resources style issues in %s' % abs_local_path |
+ file_indicator = 'Found HTML style issues in %s' % abs_local_path |
prompt_msg = file_indicator + '\n\n' + '\n'.join(errors) + '\n' |
results.append(self.output_api.PresubmitPromptWarning(prompt_msg)) |