| 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 | 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 import os as _os | 7 import os as _os |
| 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) | 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) |
| 9 | 9 |
| 10 | 10 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 return [] | 664 return [] |
| 665 | 665 |
| 666 extra_args = ['--rcfile=%s' % input_api.os_path.join(_HERE, 'pylintrc')] | 666 extra_args = ['--rcfile=%s' % input_api.os_path.join(_HERE, 'pylintrc')] |
| 667 if disabled_warnings: | 667 if disabled_warnings: |
| 668 extra_args.extend(['-d', ','.join(disabled_warnings)]) | 668 extra_args.extend(['-d', ','.join(disabled_warnings)]) |
| 669 | 669 |
| 670 files = _FetchAllFiles(input_api, white_list, black_list) | 670 files = _FetchAllFiles(input_api, white_list, black_list) |
| 671 if not files: | 671 if not files: |
| 672 return [] | 672 return [] |
| 673 | 673 |
| 674 input_api.logging.info('Running pylint on: %s', files) | 674 input_api.logging.info('Running pylint on %d files', len(files)) |
| 675 input_api.logging.debug('Running pylint on: %s', files) |
| 675 # Copy the system path to the environment so pylint can find the right | 676 # Copy the system path to the environment so pylint can find the right |
| 676 # imports. | 677 # imports. |
| 677 env = input_api.environ.copy() | 678 env = input_api.environ.copy() |
| 678 import sys | 679 import sys |
| 679 env['PYTHONPATH'] = input_api.os_path.pathsep.join( | 680 env['PYTHONPATH'] = input_api.os_path.pathsep.join( |
| 680 extra_paths_list + sys.path) | 681 extra_paths_list + sys.path) |
| 681 | 682 |
| 682 def run_lint(files): | 683 def run_lint(files): |
| 683 # We can't import pylint directly due to licensing issues, so we run | 684 # We can't import pylint directly due to licensing issues, so we run |
| 684 # it in another process. Windows needs help running python files so we | 685 # it in another process. Windows needs help running python files so we |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 snapshot("checking description") | 1008 snapshot("checking description") |
| 1008 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1009 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 1009 input_api, output_api)) | 1010 input_api, output_api)) |
| 1010 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 1011 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
| 1011 input_api, output_api)) | 1012 input_api, output_api)) |
| 1012 snapshot("checking do not submit in files") | 1013 snapshot("checking do not submit in files") |
| 1013 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 1014 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
| 1014 input_api, output_api)) | 1015 input_api, output_api)) |
| 1015 snapshot("done") | 1016 snapshot("done") |
| 1016 return results | 1017 return results |
| OLD | NEW |