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 |
11 http://www.chromium.org/developers/web-development-style-guide for the rules | 11 http://www.chromium.org/developers/web-development-style-guide for the rules |
12 checked for here. | 12 checked for here. |
13 """ | 13 """ |
14 | 14 |
15 def CheckChangeOnUpload(input_api, output_api): | 15 def CheckChangeOnUpload(input_api, output_api): |
16 return _CommonChecks(input_api, output_api) | 16 return _CommonChecks(input_api, output_api) |
17 | 17 |
18 | 18 |
19 def CheckChangeOnCommit(input_api, output_api): | 19 def CheckChangeOnCommit(input_api, output_api): |
20 return _CommonChecks(input_api, output_api) | 20 return _CommonChecks(input_api, output_api) |
21 | 21 |
22 def _RunHistogramChecks(input_api, output_api, histogram_name): | 22 def _RunHistogramChecks(input_api, output_api, histogram_name): |
23 try: | 23 try: |
24 # Setup sys.path so that we can call histrogram code | 24 # Setup sys.path so that we can call histograms code. |
25 import sys | 25 import sys |
26 original_sys_path = sys.path | 26 original_sys_path = sys.path |
27 sys.path = sys.path + [input_api.os_path.join( | 27 sys.path = sys.path + [input_api.os_path.join( |
28 input_api.change.RepositoryRoot(), | 28 input_api.change.RepositoryRoot(), |
29 'tools', 'metrics', 'histograms')] | 29 'tools', 'metrics', 'histograms')] |
30 | 30 |
31 results = [] | 31 results = [] |
32 | 32 |
33 import presubmit_bad_message_reasons | 33 import presubmit_bad_message_reasons |
34 results.extend(presubmit_bad_message_reasons.PrecheckBadMessage(input_api, | 34 results.extend(presubmit_bad_message_reasons.PrecheckBadMessage(input_api, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 results.extend(html_checker.HtmlChecker( | 98 results.extend(html_checker.HtmlChecker( |
99 input_api, output_api, file_filter=is_resource).RunChecks()) | 99 input_api, output_api, file_filter=is_resource).RunChecks()) |
100 results.extend(js_checker.JSChecker( | 100 results.extend(js_checker.JSChecker( |
101 input_api, output_api, file_filter=is_resource).RunChecks()) | 101 input_api, output_api, file_filter=is_resource).RunChecks()) |
102 results.extend(_RunHistogramChecks(input_api, output_api, | 102 results.extend(_RunHistogramChecks(input_api, output_api, |
103 "BadMessageReasonChrome")) | 103 "BadMessageReasonChrome")) |
104 finally: | 104 finally: |
105 sys.path = old_path | 105 sys.path = old_path |
106 | 106 |
107 return results | 107 return results |
OLD | NEW |