| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Presubmit script for Chromium JS resources. | 5 """Presubmit script for Chromium JS resources. |
| 6 | 6 |
| 7 See chrome/browser/PRESUBMIT.py | 7 See chrome/browser/PRESUBMIT.py |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import regex_check | 10 import regex_check |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 return not is_grit_statement and error.code not in [ | 182 return not is_grit_statement and error.code not in [ |
| 183 errors.COMMA_AT_END_OF_LITERAL, | 183 errors.COMMA_AT_END_OF_LITERAL, |
| 184 errors.JSDOC_ILLEGAL_QUESTION_WITH_PIPE, | 184 errors.JSDOC_ILLEGAL_QUESTION_WITH_PIPE, |
| 185 errors.LINE_TOO_LONG, | 185 errors.LINE_TOO_LONG, |
| 186 errors.MISSING_JSDOC_TAG_THIS, | 186 errors.MISSING_JSDOC_TAG_THIS, |
| 187 ] | 187 ] |
| 188 | 188 |
| 189 # Whitelist Polymer-specific JsDoc tags. | 189 # Whitelist Polymer-specific JsDoc tags. |
| 190 gflags.FLAGS.custom_jsdoc_tags = ('group', 'element', 'attribute', | 190 gflags.FLAGS.custom_jsdoc_tags = ('group', 'element', 'attribute', |
| 191 'default') | 191 'default', 'polymerBehavior') |
| 192 error_handler = ErrorHandlerImpl(self.input_api.re) | 192 error_handler = ErrorHandlerImpl(self.input_api.re) |
| 193 runner.Run(file_to_lint, error_handler, source=source) | 193 runner.Run(file_to_lint, error_handler, source=source) |
| 194 return error_handler.GetErrors() | 194 return error_handler.GetErrors() |
| 195 | 195 |
| 196 def RunChecks(self): | 196 def RunChecks(self): |
| 197 """Check for violations of the Chromium JavaScript style guide. See | 197 """Check for violations of the Chromium JavaScript style guide. See |
| 198 http://chromium.org/developers/web-development-style-guide#TOC-JavaScript | 198 http://chromium.org/developers/web-development-style-guide#TOC-JavaScript |
| 199 """ | 199 """ |
| 200 results = [] | 200 results = [] |
| 201 | 201 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 results.append(self._MakeErrorOrWarning( | 245 results.append(self._MakeErrorOrWarning( |
| 246 '\n'.join(error_lines), f.AbsoluteLocalPath())) | 246 '\n'.join(error_lines), f.AbsoluteLocalPath())) |
| 247 | 247 |
| 248 if results: | 248 if results: |
| 249 results.append(self.output_api.PresubmitNotifyResult( | 249 results.append(self.output_api.PresubmitNotifyResult( |
| 250 'See the JavaScript style guide at ' | 250 'See the JavaScript style guide at ' |
| 251 'http://www.chromium.org/developers/web-development-style-guide' | 251 'http://www.chromium.org/developers/web-development-style-guide' |
| 252 '#TOC-JavaScript')) | 252 '#TOC-JavaScript')) |
| 253 | 253 |
| 254 return results | 254 return results |
| OLD | NEW |