Chromium Code Reviews| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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: %s', files) |
| 675 # Copy the system path to the environment so pylint can find the right | 675 # Copy the system path to the environment so pylint can find the right |
| 676 # imports. | 676 # imports. |
| 677 env = input_api.environ.copy() | 677 env = input_api.environ.copy() |
| 678 import sys | 678 import sys |
| 679 env['PYTHONPATH'] = input_api.os_path.pathsep.join( | 679 env['PYTHONPATH'] = input_api.os_path.pathsep.join( |
| 680 extra_paths_list + sys.path) | 680 extra_paths_list + sys.path).encode('ascii', 'ignore') |
|
M-A Ruel
2013/02/19 21:07:40
utf8
technically we'd want the code page but utf8
robertshield
2013/02/20 15:23:37
Done.
| |
| 681 | 681 |
| 682 def run_lint(files): | 682 def run_lint(files): |
| 683 # We can't import pylint directly due to licensing issues, so we run | 683 # 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 | 684 # it in another process. Windows needs help running python files so we |
| 685 # explicitly specify the interpreter to use. It also has limitations on | 685 # explicitly specify the interpreter to use. It also has limitations on |
| 686 # the size of the command-line, so we pass arguments via a pipe. | 686 # the size of the command-line, so we pass arguments via a pipe. |
| 687 command = [input_api.python_executable, | 687 command = [input_api.python_executable, |
| 688 input_api.os_path.join(_HERE, 'third_party', 'pylint.py'), | 688 input_api.os_path.join(_HERE, 'third_party', 'pylint.py'), |
| 689 '--args-on-stdin'] | 689 '--args-on-stdin'] |
| 690 try: | 690 try: |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 snapshot("checking description") | 1007 snapshot("checking description") |
| 1008 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1008 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 1009 input_api, output_api)) | 1009 input_api, output_api)) |
| 1010 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 1010 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
| 1011 input_api, output_api)) | 1011 input_api, output_api)) |
| 1012 snapshot("checking do not submit in files") | 1012 snapshot("checking do not submit in files") |
| 1013 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 1013 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
| 1014 input_api, output_api)) | 1014 input_api, output_api)) |
| 1015 snapshot("done") | 1015 snapshot("done") |
| 1016 return results | 1016 return results |
| OLD | NEW |