Chromium Code Reviews| 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 WebUI resources. | 5 """Presubmit script for Chromium WebUI resources. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl/git cl, and see | 8 for more details about the presubmit API built into gcl/git cl, and see |
| 9 http://www.chromium.org/developers/web-development-style-guide for the rules | 9 http://www.chromium.org/developers/web-development-style-guide for the rules |
| 10 we're checking against here. | 10 we're checking against here. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 import sys | 40 import sys |
| 41 old_path = sys.path | 41 old_path = sys.path |
| 42 | 42 |
| 43 try: | 43 try: |
| 44 sys.path = [resources] + old_path | 44 sys.path = [resources] + old_path |
| 45 from web_dev_style import css_checker, js_checker | 45 from web_dev_style import css_checker, js_checker |
| 46 | 46 |
| 47 def _html_css_js_resource(p): | 47 def _html_css_js_resource(p): |
| 48 return p.endswith(('.html', '.css', '.js')) and p.startswith(resources) | 48 return p.endswith(('.html', '.css', '.js')) and p.startswith(resources) |
| 49 | 49 |
| 50 WHITELIST = ['chrome/browser/resources/pdf/index.html', | |
| 51 'chrome/browser/resources/pdf/index.js'] | |
| 50 def is_resource(maybe_resource): | 52 def is_resource(maybe_resource): |
| 51 return _html_css_js_resource(maybe_resource.AbsoluteLocalPath()) | 53 return (not(maybe_resource.LocalPath() in WHITELIST) and |
|
M-A Ruel
2014/02/15 01:46:57
then it is a blacklist. Rename the variable, and u
raymes
2014/02/16 23:14:31
Done.
| |
| 54 _html_css_js_resource(maybe_resource.AbsoluteLocalPath())) | |
| 52 | 55 |
| 53 results.extend(css_checker.CSSChecker( | 56 results.extend(css_checker.CSSChecker( |
| 54 input_api, output_api, file_filter=is_resource).RunChecks()) | 57 input_api, output_api, file_filter=is_resource).RunChecks()) |
| 55 results.extend(js_checker.JSChecker( | 58 results.extend(js_checker.JSChecker( |
| 56 input_api, output_api, file_filter=is_resource).RunChecks()) | 59 input_api, output_api, file_filter=is_resource).RunChecks()) |
| 57 finally: | 60 finally: |
| 58 sys.path = old_path | 61 sys.path = old_path |
| 59 | 62 |
| 60 return results | 63 return results |
| OLD | NEW |