OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """ | 5 """ |
6 Presubmit for Chromium HTML resources. See chrome/browser/PRESUBMIT.py. | 6 Presubmit for Chromium HTML resources. See chrome/browser/PRESUBMIT.py. |
7 """ | 7 """ |
8 | 8 |
9 import regex_check | 9 import regex_check |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 def RunChecks(self): | 84 def RunChecks(self): |
85 """Check for violations of the Chromium web development style guide. See | 85 """Check for violations of the Chromium web development style guide. See |
86 http://chromium.org/developers/web-development-style-guide | 86 http://chromium.org/developers/web-development-style-guide |
87 """ | 87 """ |
88 results = [] | 88 results = [] |
89 | 89 |
90 affected_files = self.input_api.change.AffectedFiles( | 90 affected_files = self.input_api.change.AffectedFiles( |
91 file_filter=self.file_filter, include_deletes=False) | 91 file_filter=self.file_filter, include_deletes=False) |
92 | 92 |
93 for f in affected_files: | 93 for f in affected_files: |
| 94 if not f.LocalPath().endswith('.html'): |
| 95 continue |
| 96 |
94 errors = [] | 97 errors = [] |
95 | 98 |
96 for line_number, line in f.ChangedContents(): | 99 for line_number, line in f.ChangedContents(): |
97 errors.extend(filter(None, [ | 100 errors.extend(filter(None, [ |
98 self.ClassesUseDashFormCheck(line_number, line), | 101 self.ClassesUseDashFormCheck(line_number, line), |
99 self.DoNotCloseSingleTagsCheck(line_number, line), | 102 self.DoNotCloseSingleTagsCheck(line_number, line), |
100 self.DoNotUseBrElementCheck(line_number, line), | 103 self.DoNotUseBrElementCheck(line_number, line), |
101 self.DoNotUseInputTypeButtonCheck(line_number, line), | 104 self.DoNotUseInputTypeButtonCheck(line_number, line), |
102 self.I18nContentJavaScriptCaseCheck(line_number, line), | 105 self.I18nContentJavaScriptCaseCheck(line_number, line), |
103 self.LabelCheck(line_number, line), | 106 self.LabelCheck(line_number, line), |
104 self.QuotePolymerBindings(line_number, line), | 107 self.QuotePolymerBindings(line_number, line), |
105 ])) | 108 ])) |
106 | 109 |
107 if errors: | 110 if errors: |
108 abs_local_path = f.AbsoluteLocalPath() | 111 abs_local_path = f.AbsoluteLocalPath() |
109 file_indicator = 'Found HTML style issues in %s' % abs_local_path | 112 file_indicator = 'Found HTML style issues in %s' % abs_local_path |
110 prompt_msg = file_indicator + '\n\n' + '\n'.join(errors) + '\n' | 113 prompt_msg = file_indicator + '\n\n' + '\n'.join(errors) + '\n' |
111 results.append(self.output_api.PresubmitPromptWarning(prompt_msg)) | 114 results.append(self.output_api.PresubmitPromptWarning(prompt_msg)) |
112 | 115 |
113 return results | 116 return results |
OLD | NEW |