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 # Justifications for each filter: | 10 # Justifications for each filter: |
11 # | 11 # |
12 # - build/include : Too many; fix in the future. | 12 # - build/include : Too many; fix in the future. |
13 # - build/include_order : Not happening; #ifdefed includes. | 13 # - build/include_order : Not happening; #ifdefed includes. |
14 # - build/namespace : I'm surprised by how often we violate this rule. | 14 # - build/namespace : I'm surprised by how often we violate this rule. |
15 # - readability/casting : Mistakes a whole bunch of function pointer. | 15 # - readability/casting : Mistakes a whole bunch of function pointer. |
16 # - runtime/int : Can be fixed long term; volume of errors too high | 16 # - runtime/int : Can be fixed long term; volume of errors too high |
17 # - runtime/virtual : Broken now, but can be fixed in the future? | 17 # - runtime/virtual : Broken now, but can be fixed in the future? |
18 # - whitespace/braces : We have a lot of explicit scoping in chrome code. | 18 # - whitespace/braces : We have a lot of explicit scoping in chrome code. |
19 # - readability/inheritance : Temporary, while the OVERRIDE and FINAL fixup | |
20 # is in progress. | |
21 DEFAULT_LINT_FILTERS = [ | 19 DEFAULT_LINT_FILTERS = [ |
22 '-build/include', | 20 '-build/include', |
23 '-build/include_order', | 21 '-build/include_order', |
24 '-build/namespace', | 22 '-build/namespace', |
25 '-readability/casting', | 23 '-readability/casting', |
26 '-runtime/int', | 24 '-runtime/int', |
27 '-runtime/virtual', | 25 '-runtime/virtual', |
28 '-whitespace/braces', | 26 '-whitespace/braces', |
29 '-readability/inheritance' | |
30 ] | 27 ] |
31 | 28 |
32 ### Description checks | 29 ### Description checks |
33 | 30 |
34 def CheckChangeHasTestField(input_api, output_api): | 31 def CheckChangeHasTestField(input_api, output_api): |
35 """Requires that the changelist have a TEST= field.""" | 32 """Requires that the changelist have a TEST= field.""" |
36 if input_api.change.TEST: | 33 if input_api.change.TEST: |
37 return [] | 34 return [] |
38 else: | 35 else: |
39 return [output_api.PresubmitNotifyResult( | 36 return [output_api.PresubmitNotifyResult( |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 for f in affected_files: | 1115 for f in affected_files: |
1119 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] | 1116 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] |
1120 rc = gn.main(cmd) | 1117 rc = gn.main(cmd) |
1121 if rc == 2: | 1118 if rc == 2: |
1122 warnings.append(output_api.PresubmitPromptWarning( | 1119 warnings.append(output_api.PresubmitPromptWarning( |
1123 '%s requires formatting. Please run `gn format --in-place %s`.' % ( | 1120 '%s requires formatting. Please run `gn format --in-place %s`.' % ( |
1124 f.AbsoluteLocalPath(), f.LocalPath()))) | 1121 f.AbsoluteLocalPath(), f.LocalPath()))) |
1125 # It's just a warning, so ignore other types of failures assuming they'll be | 1122 # It's just a warning, so ignore other types of failures assuming they'll be |
1126 # caught elsewhere. | 1123 # caught elsewhere. |
1127 return warnings | 1124 return warnings |
OLD | NEW |