OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 | 7 |
8 ### Description checks | 8 ### Description checks |
9 | 9 |
10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 result = e.code | 591 result = e.code |
592 except ImportError: | 592 except ImportError: |
593 if input_api.platform == 'win32': | 593 if input_api.platform == 'win32': |
594 return [output_api.PresubmitNotifyResult( | 594 return [output_api.PresubmitNotifyResult( |
595 'Warning: Can\'t run pylint because it is not installed. Please ' | 595 'Warning: Can\'t run pylint because it is not installed. Please ' |
596 'install manually\n' | 596 'install manually\n' |
597 'Cannot do static analysis of python files.')] | 597 'Cannot do static analysis of python files.')] |
598 return [output_api.PresubmitError( | 598 return [output_api.PresubmitError( |
599 'Please install pylint with "sudo apt-get install python-setuptools; ' | 599 'Please install pylint with "sudo apt-get install python-setuptools; ' |
600 'sudo easy_install pylint"\n' | 600 'sudo easy_install pylint"\n' |
| 601 'or visit http://pypi.python.org/pypi/setuptools.\n' |
601 'Cannot do static analysis of python files.')] | 602 'Cannot do static analysis of python files.')] |
602 if result: | 603 if result: |
603 if input_api.is_committing: | 604 if input_api.is_committing: |
604 error_type = output_api.PresubmitError | 605 error_type = output_api.PresubmitError |
605 else: | 606 else: |
606 error_type = output_api.PresubmitPromptWarning | 607 error_type = output_api.PresubmitPromptWarning |
607 return [error_type('Fix pylint errors first.')] | 608 return [error_type('Fix pylint errors first.')] |
608 return [] | 609 return [] |
609 finally: | 610 finally: |
610 warnings.filterwarnings('default', category=DeprecationWarning) | 611 warnings.filterwarnings('default', category=DeprecationWarning) |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 input_api, output_api, source_file_filter=text_files)) | 900 input_api, output_api, source_file_filter=text_files)) |
900 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 901 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
901 input_api, output_api)) | 902 input_api, output_api)) |
902 results.extend(input_api.canned_checks.CheckLicense( | 903 results.extend(input_api.canned_checks.CheckLicense( |
903 input_api, output_api, license_header, source_file_filter=sources)) | 904 input_api, output_api, license_header, source_file_filter=sources)) |
904 results.extend(_CheckConstNSObject( | 905 results.extend(_CheckConstNSObject( |
905 input_api, output_api, source_file_filter=sources)) | 906 input_api, output_api, source_file_filter=sources)) |
906 results.extend(_CheckSingletonInHeaders( | 907 results.extend(_CheckSingletonInHeaders( |
907 input_api, output_api, source_file_filter=sources)) | 908 input_api, output_api, source_file_filter=sources)) |
908 return results | 909 return results |
OLD | NEW |