OLD | NEW |
1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. 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 """Top-level presubmit script for GYP. | 6 """Top-level presubmit script for GYP. |
7 | 7 |
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
9 for more details about the presubmit API built into gcl. | 9 for more details about the presubmit API built into gcl. |
10 """ | 10 """ |
11 | 11 |
12 | 12 |
| 13 PYLINT_BLACKLIST = [ |
| 14 # TODO: fix me. |
| 15 # From SCons, not done in google style. |
| 16 'test/lib/TestCmd.py', |
| 17 'test/lib/TestCommon.py', |
| 18 'test/lib/TestGyp.py', |
| 19 # Needs style fix. |
| 20 'pylib/gyp/generator/scons.py', |
| 21 'pylib/gyp/generator/xcode.py', |
| 22 ] |
| 23 |
| 24 |
| 25 PYLINT_DISABLED_WARNINGS = [ |
| 26 # TODO: fix me. |
| 27 # Many tests include modules they don't use. |
| 28 'W0611', |
| 29 # Include order doesn't properly include local files? |
| 30 'F0401', |
| 31 # Some use of built-in names. |
| 32 'W0622', |
| 33 # Some unused variables. |
| 34 'W0612', |
| 35 # Operator not preceded/followed by space. |
| 36 'C0323', |
| 37 'C0322', |
| 38 # Unnecessary semicolon. |
| 39 'W0301', |
| 40 # Unused argument. |
| 41 'W0613', |
| 42 # String has no effect (docstring in wrong place). |
| 43 'W0105', |
| 44 # Comma not followed by space. |
| 45 'C0324', |
| 46 # Access to a protected member. |
| 47 'W0212', |
| 48 # Bad indent. |
| 49 'W0311', |
| 50 # Line too long. |
| 51 'C0301', |
| 52 # Undefined variable. |
| 53 'E0602', |
| 54 # Not exception type specified. |
| 55 'W0702', |
| 56 # No member of that name. |
| 57 'E1101', |
| 58 # Dangerous default {}. |
| 59 'W0102', |
| 60 # Others, too many to sort. |
| 61 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', |
| 62 'R0201', 'E0101', 'C0321', 'W0602', 'W0631', 'W0601', 'W0701', |
| 63 'E0102', 'W0221', 'W0403', |
| 64 ] |
| 65 |
| 66 |
13 def CheckChangeOnUpload(input_api, output_api): | 67 def CheckChangeOnUpload(input_api, output_api): |
14 report = [] | 68 report = [] |
15 report.extend(input_api.canned_checks.PanProjectChecks( | 69 report.extend(input_api.canned_checks.PanProjectChecks( |
16 input_api, output_api)) | 70 input_api, output_api)) |
17 return report | 71 return report |
18 | 72 |
19 | 73 |
20 def CheckChangeOnCommit(input_api, output_api): | 74 def CheckChangeOnCommit(input_api, output_api): |
21 report = [] | 75 report = [] |
22 license = ( | 76 license = ( |
(...skipping 11 matching lines...) Expand all Loading... |
34 input_api, output_api, | 88 input_api, output_api, |
35 'http://gyp-status.appspot.com/status', | 89 'http://gyp-status.appspot.com/status', |
36 'http://gyp-status.appspot.com/current')) | 90 'http://gyp-status.appspot.com/current')) |
37 | 91 |
38 import sys | 92 import sys |
39 old_sys_path = sys.path | 93 old_sys_path = sys.path |
40 try: | 94 try: |
41 sys.path = ['pylib', 'test/lib'] + sys.path | 95 sys.path = ['pylib', 'test/lib'] + sys.path |
42 report.extend(input_api.canned_checks.RunPylint( | 96 report.extend(input_api.canned_checks.RunPylint( |
43 input_api, | 97 input_api, |
44 output_api)) | 98 output_api, |
| 99 black_list=PYLINT_BLACKLIST, |
| 100 disabled_warnings=PYLINT_DISABLED_WARNINGS)) |
45 finally: | 101 finally: |
46 sys.path = old_sys_path | 102 sys.path = old_sys_path |
47 return report | 103 return report |
48 | 104 |
49 | 105 |
50 def GetPreferredTrySlaves(): | 106 def GetPreferredTrySlaves(): |
51 return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac'] | 107 return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac'] |
OLD | NEW |