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 """Top-level presubmit script for depot tools. | 5 """Top-level presubmit script for depot tools. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
| 8 details on the presubmit API built into depot_tools. | 8 details on the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import fnmatch | |
| 12 import os | |
|
M-A Ruel
2014/03/18 19:29:16
Not needed.
| |
| 13 | |
| 11 | 14 |
| 12 def CommonChecks(input_api, output_api, tests_to_black_list): | 15 def CommonChecks(input_api, output_api, tests_to_black_list): |
| 13 results = [] | 16 results = [] |
| 14 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) | 17 results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
| 15 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ | 18 black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
| 16 r'^cpplint\.py$', | 19 r'^cpplint\.py$', |
| 17 r'^cpplint_chromium\.py$', | 20 r'^cpplint_chromium\.py$', |
| 18 r'^python[0-9]*_bin[\/\\].+', | 21 r'^python[0-9]*_bin[\/\\].+', |
| 19 r'^site-packages-py[0-9]\.[0-9][\/\\].+', | 22 r'^site-packages-py[0-9]\.[0-9][\/\\].+', |
| 20 r'^svn_bin[\/\\].+', | 23 r'^svn_bin[\/\\].+', |
| 21 r'^testing_support[\/\\]_rietveld[\/\\].+'] | 24 r'^testing_support[\/\\]_rietveld[\/\\].+'] |
| 25 if os.path.exists('.gitignore'): | |
|
M-A Ruel
2014/03/18 19:29:16
input_api.os_path.exists
| |
| 26 with open('.gitignore') as fh: | |
| 27 lines = [l.strip() for l in fh.readlines()] | |
| 28 black_list.extend([fnmatch.translate(l) for l in lines if | |
| 29 l and not l.startswith('#')]) | |
| 30 if os.path.exists('.git/info/exclude'): | |
| 31 with open('.git/info/exclude') as fh: | |
| 32 lines = [l.strip() for l in fh.readlines()] | |
| 33 black_list.extend([fnmatch.translate(l) for l in lines if | |
| 34 l and not l.startswith('#')]) | |
| 22 disabled_warnings = [ | 35 disabled_warnings = [ |
| 23 'R0401', # Cyclic import | 36 'R0401', # Cyclic import |
| 24 'W0613', # Unused argument | 37 'W0613', # Unused argument |
| 25 ] | 38 ] |
| 26 pylint = input_api.canned_checks.GetPylint( | 39 pylint = input_api.canned_checks.GetPylint( |
| 27 input_api, | 40 input_api, |
| 28 output_api, | 41 output_api, |
| 29 white_list=[r'.*\.py$'], | 42 white_list=[r'.*\.py$'], |
| 30 black_list=black_list, | 43 black_list=black_list, |
| 31 disabled_warnings=disabled_warnings) | 44 disabled_warnings=disabled_warnings) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 | 120 |
| 108 | 121 |
| 109 def CheckChangeOnCommit(input_api, output_api): | 122 def CheckChangeOnCommit(input_api, output_api): |
| 110 output = [] | 123 output = [] |
| 111 output.extend(CommonChecks(input_api, output_api, [])) | 124 output.extend(CommonChecks(input_api, output_api, [])) |
| 112 output.extend(input_api.canned_checks.CheckDoNotSubmit( | 125 output.extend(input_api.canned_checks.CheckDoNotSubmit( |
| 113 input_api, | 126 input_api, |
| 114 output_api)) | 127 output_api)) |
| 115 output.extend(RunGitClTests(input_api, output_api)) | 128 output.extend(RunGitClTests(input_api, output_api)) |
| 116 return output | 129 return output |
| OLD | NEW |