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 import os | 4 import os |
5 import sys | 5 import sys |
6 | 6 |
7 PYLINT_BLACKLIST = [] | 7 PYLINT_BLACKLIST = [] |
8 PYLINT_DISABLED_WARNINGS = [] | 8 PYLINT_DISABLED_WARNINGS = ['R0923'] |
9 | 9 |
10 def CheckChangeOnUpload(input_api, output_api): | 10 def _CommonChecks(input_api, output_api): |
11 report = [] | 11 results = [] |
12 report.extend(input_api.canned_checks.PanProjectChecks( | 12 results.extend(input_api.canned_checks.PanProjectChecks( |
13 input_api, output_api)) | 13 input_api, output_api)) |
14 return report | |
15 | 14 |
16 def CheckChangeOnCommit(input_api, output_api): | |
17 report = [] | |
18 report.extend(input_api.canned_checks.PanProjectChecks(input_api, output_api)) | |
19 | 15 |
20 old_sys_path = sys.path | 16 old_sys_path = sys.path |
21 try: | 17 try: |
22 sys.path = [os.path.join('..', 'chrome_remote_control')] + sys.path | 18 sys.path = [os.path.join('..', 'chrome_remote_control')] + sys.path |
23 report.extend(input_api.canned_checks.RunPylint( | 19 results.extend(input_api.canned_checks.RunPylint( |
24 input_api, output_api, | 20 input_api, output_api, |
25 black_list=PYLINT_BLACKLIST, | 21 black_list=PYLINT_BLACKLIST, |
26 disabled_warnings=PYLINT_DISABLED_WARNINGS)) | 22 disabled_warnings=PYLINT_DISABLED_WARNINGS)) |
27 finally: | 23 finally: |
28 sys.path = old_sys_path | 24 sys.path = old_sys_path |
29 | 25 |
| 26 |
| 27 |
| 28 return results |
| 29 |
| 30 def CheckChangeOnUpload(input_api, output_api): |
| 31 report = [] |
| 32 report.extend(_CommonChecks(input_api, output_api)) |
30 return report | 33 return report |
| 34 |
| 35 def CheckChangeOnCommit(input_api, output_api): |
| 36 report = [] |
| 37 report.extend(_CommonChecks(input_api, output_api)) |
| 38 return report |
OLD | NEW |