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 """Presubmit script for Chromium browser code. | 5 """Presubmit script for Chromium browser code. |
6 | 6 |
7 This script currently checks HTML/CSS/JS files in resources/ and ui/webui/. | 7 This script currently checks HTML/CSS/JS files in resources/ and ui/webui/. |
8 | 8 |
9 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 9 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
10 for more details about the presubmit API built into depot_tools, and see | 10 for more details about the presubmit API built into depot_tools, and see |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 try: | 49 try: |
50 sys.path = [cwd] + old_path | 50 sys.path = [cwd] + old_path |
51 from web_dev_style import (resource_checker, css_checker, html_checker, | 51 from web_dev_style import (resource_checker, css_checker, html_checker, |
52 js_checker) | 52 js_checker) |
53 | 53 |
54 search_dirs = (resources, webui) | 54 search_dirs = (resources, webui) |
55 def _html_css_js_resource(p): | 55 def _html_css_js_resource(p): |
56 return p.endswith(('.html', '.css', '.js')) and p.startswith(search_dirs) | 56 return p.endswith(('.html', '.css', '.js')) and p.startswith(search_dirs) |
57 | 57 |
58 BLACKLIST = ['chrome/browser/resources/pdf/index.html', | 58 BLACKLIST = ['chrome/browser/resources/md_downloads/crisper.js', |
| 59 'chrome/browser/resources/md_downloads/vulcanized.html', |
| 60 'chrome/browser/resources/pdf/index.html', |
59 'chrome/browser/resources/pdf/index.js'] | 61 'chrome/browser/resources/pdf/index.js'] |
60 def is_resource(maybe_resource): | 62 def is_resource(maybe_resource): |
61 return (maybe_resource.LocalPath() not in BLACKLIST and | 63 return (maybe_resource.LocalPath() not in BLACKLIST and |
62 _html_css_js_resource(maybe_resource.AbsoluteLocalPath())) | 64 _html_css_js_resource(maybe_resource.AbsoluteLocalPath())) |
63 | 65 |
64 results.extend(resource_checker.ResourceChecker( | 66 results.extend(resource_checker.ResourceChecker( |
65 input_api, output_api, file_filter=is_resource).RunChecks()) | 67 input_api, output_api, file_filter=is_resource).RunChecks()) |
66 results.extend(css_checker.CSSChecker( | 68 results.extend(css_checker.CSSChecker( |
67 input_api, output_api, file_filter=is_resource).RunChecks()) | 69 input_api, output_api, file_filter=is_resource).RunChecks()) |
68 results.extend(html_checker.HtmlChecker( | 70 results.extend(html_checker.HtmlChecker( |
69 input_api, output_api, file_filter=is_resource).RunChecks()) | 71 input_api, output_api, file_filter=is_resource).RunChecks()) |
70 results.extend(js_checker.JSChecker( | 72 results.extend(js_checker.JSChecker( |
71 input_api, output_api, file_filter=is_resource).RunChecks()) | 73 input_api, output_api, file_filter=is_resource).RunChecks()) |
72 finally: | 74 finally: |
73 sys.path = old_path | 75 sys.path = old_path |
74 | 76 |
75 return results | 77 return results |
OLD | NEW |