OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 | 5 |
6 def _CommonChecks(input_api, output_api): | 6 def _CommonChecks(input_api, output_api): |
7 results = [] | 7 results = [] |
8 | 8 |
9 # Run Pylint over the files in the directory. | 9 # Run Pylint over the files in the directory. |
10 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) | 10 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) |
11 results.extend(input_api.RunTests(pylint_checks)) | 11 results.extend(input_api.RunTests(pylint_checks)) |
12 | 12 |
13 # Run the MB unittests. | 13 # Run the MB unittests. |
14 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 14 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
15 input_api, output_api, '.', [ r'^.+_unittest\.py$'])) | 15 input_api, output_api, '.', [ r'^.+_unittest\.py$'])) |
16 | 16 |
17 # Validate the format of the mb_config.pyl file. | 17 # Validate the format of the mb_config.pyl file. |
18 cmd = [input_api.python_executable, 'mb.py', 'validate'] | 18 cmd = [input_api.python_executable, 'mb.py', 'validate'] |
19 kwargs = {'cwd': input_api.PresubmitLocalPath()} | 19 kwargs = {'cwd': input_api.PresubmitLocalPath()} |
20 results.extend(input_api.RunTests([ | 20 results.extend(input_api.RunTests([ |
21 input_api.Command(name='mb_validate', | 21 input_api.Command(name='mb_validate', |
22 cmd=cmd, kwargs=kwargs, | 22 cmd=cmd, kwargs=kwargs, |
23 message=output_api.PresubmitError)])) | 23 message=output_api.PresubmitError)])) |
24 | 24 |
25 results.extend( | |
26 input_api.canned_checks.CheckLongLines( | |
27 input_api, | |
28 output_api, | |
29 maxlen=80, | |
30 source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath())) | |
31 | |
32 return results | 25 return results |
33 | 26 |
34 | 27 |
35 def CheckChangeOnUpload(input_api, output_api): | 28 def CheckChangeOnUpload(input_api, output_api): |
36 return _CommonChecks(input_api, output_api) | 29 return _CommonChecks(input_api, output_api) |
37 | 30 |
38 | 31 |
39 def CheckChangeOnCommit(input_api, output_api): | 32 def CheckChangeOnCommit(input_api, output_api): |
40 return _CommonChecks(input_api, output_api) | 33 return _CommonChecks(input_api, output_api) |
OLD | NEW |