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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 '}.bind(' in error.token.line): | 178 '}.bind(' in error.token.line): |
179 return False | 179 return False |
180 | 180 |
181 return not is_grit_statement and error.code not in [ | 181 return not is_grit_statement and error.code not in [ |
182 errors.COMMA_AT_END_OF_LITERAL, | 182 errors.COMMA_AT_END_OF_LITERAL, |
183 errors.JSDOC_ILLEGAL_QUESTION_WITH_PIPE, | 183 errors.JSDOC_ILLEGAL_QUESTION_WITH_PIPE, |
184 errors.LINE_TOO_LONG, | 184 errors.LINE_TOO_LONG, |
185 errors.MISSING_JSDOC_TAG_THIS, | 185 errors.MISSING_JSDOC_TAG_THIS, |
186 ] | 186 ] |
187 | 187 |
188 # Whitelist Polymer-specific JsDoc tags. | 188 # Keep this in sync with third_party/closure_compiler/closure_args.gypi |
189 gflags.FLAGS.custom_jsdoc_tags = ('group', 'element', 'attribute', | 189 gflags.FLAGS.custom_jsdoc_tags = ( |
190 'default', 'polymerBehavior') | 190 'abstract', |
191 'attribute', | |
192 'default', | |
193 'demo', | |
194 'element', | |
195 'group', | |
196 'hero', | |
197 'polymerBehavior' | |
Dan Beam
2016/07/11 21:13:26
why, yes it could be related to this! :P
| |
198 'status', | |
199 'submodule', | |
200 ) | |
191 error_handler = ErrorHandlerImpl(self.input_api.re) | 201 error_handler = ErrorHandlerImpl(self.input_api.re) |
192 runner.Run(file_to_lint, error_handler, source=source) | 202 runner.Run(file_to_lint, error_handler, source=source) |
193 return error_handler.GetErrors() | 203 return error_handler.GetErrors() |
194 | 204 |
195 def RunChecks(self): | 205 def RunChecks(self): |
196 """Check for violations of the Chromium JavaScript style guide. See | 206 """Check for violations of the Chromium JavaScript style guide. See |
197 http://chromium.org/developers/web-development-style-guide#TOC-JavaScript | 207 http://chromium.org/developers/web-development-style-guide#TOC-JavaScript |
198 """ | 208 """ |
199 results = [] | 209 results = [] |
200 | 210 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 results.append(self._MakeErrorOrWarning( | 254 results.append(self._MakeErrorOrWarning( |
245 '\n'.join(error_lines), f.AbsoluteLocalPath())) | 255 '\n'.join(error_lines), f.AbsoluteLocalPath())) |
246 | 256 |
247 if results: | 257 if results: |
248 results.append(self.output_api.PresubmitNotifyResult( | 258 results.append(self.output_api.PresubmitNotifyResult( |
249 'See the JavaScript style guide at ' | 259 'See the JavaScript style guide at ' |
250 'http://www.chromium.org/developers/web-development-style-guide' | 260 'http://www.chromium.org/developers/web-development-style-guide' |
251 '#TOC-JavaScript')) | 261 '#TOC-JavaScript')) |
252 | 262 |
253 return results | 263 return results |
OLD | NEW |