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 """Run the Chrome WebUI presubmit scripts on our test javascript. | 5 """Run the Chrome WebUI presubmit scripts on our test javascript. |
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 depot_tools, and see | 8 for more details about the presubmit API built into depot_tools, and see |
9 https://chromium.googlesource.com/chromium/src/+/master/styleguide/web/web.md | 9 https://chromium.googlesource.com/chromium/src/+/master/styleguide/web/web.md |
10 for the rules we're checking against here. | 10 for the rules we're checking against here. |
11 """ | 11 """ |
12 | 12 |
13 import os | 13 import os |
14 | 14 |
15 def GetPathsToPrepend(input_api): | 15 def GetPathsToPrepend(input_api): |
16 web_dev_style_path = input_api.os_path.join( | 16 web_dev_style_path = input_api.os_path.join( |
17 input_api.change.RepositoryRoot(), | 17 input_api.change.RepositoryRoot(), |
18 'chrome', | 18 'tools') |
lazyboy
2017/07/07 23:54:58
What is this change?
Devlin
2017/07/10 22:28:03
This activity log test folder has a presubmit inte
| |
19 'browser', | |
20 'resources') | |
21 return [input_api.PresubmitLocalPath(), web_dev_style_path] | 19 return [input_api.PresubmitLocalPath(), web_dev_style_path] |
22 | 20 |
23 def RunWithPrependedPath(prepended_path, fn, *args): | 21 def RunWithPrependedPath(prepended_path, fn, *args): |
24 import sys | 22 import sys |
25 old_path = sys.path | 23 old_path = sys.path |
26 | 24 |
27 try: | 25 try: |
28 sys.path = prepended_path + old_path | 26 sys.path = prepended_path + old_path |
29 return fn(*args) | 27 return fn(*args) |
30 finally: | 28 finally: |
(...skipping 22 matching lines...) Expand all Loading... | |
53 def is_resource(maybe_resource): | 51 def is_resource(maybe_resource): |
54 return _html_css_js_resource(maybe_resource.AbsoluteLocalPath()) | 52 return _html_css_js_resource(maybe_resource.AbsoluteLocalPath()) |
55 | 53 |
56 from web_dev_style import js_checker | 54 from web_dev_style import js_checker |
57 | 55 |
58 results = [] | 56 results = [] |
59 results.extend(js_checker.JSChecker( | 57 results.extend(js_checker.JSChecker( |
60 input_api, output_api, file_filter=is_resource).RunChecks()) | 58 input_api, output_api, file_filter=is_resource).RunChecks()) |
61 | 59 |
62 return results | 60 return results |
OLD | NEW |