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 Chromium. | 5 """Top-level presubmit script for Chromium. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 | 1579 |
1580 if len(files): | 1580 if len(files): |
1581 return [output_api.PresubmitError( | 1581 return [output_api.PresubmitError( |
1582 'Do not introduce new mojom targets with use_new_wrapper_types set to ' | 1582 'Do not introduce new mojom targets with use_new_wrapper_types set to ' |
1583 'false. The mode is deprecated and will be removed soon.', | 1583 'false. The mode is deprecated and will be removed soon.', |
1584 files)] | 1584 files)] |
1585 return [] | 1585 return [] |
1586 | 1586 |
1587 | 1587 |
1588 def _CheckUselessForwardDeclarations(input_api, output_api): | 1588 def _CheckUselessForwardDeclarations(input_api, output_api): |
1589 """Checks that added or removed lines in affected header files | 1589 """Checks that added or removed lines in non third party affected |
1590 do not lead to new useless class or struct forward declaration. | 1590 header files do not lead to new useless class or struct forward |
| 1591 declaration. |
1591 """ | 1592 """ |
1592 results = [] | 1593 results = [] |
1593 class_pattern = input_api.re.compile(r'^class\s+(\w+);$', | 1594 class_pattern = input_api.re.compile(r'^class\s+(\w+);$', |
1594 input_api.re.MULTILINE) | 1595 input_api.re.MULTILINE) |
1595 struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$', | 1596 struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$', |
1596 input_api.re.MULTILINE) | 1597 input_api.re.MULTILINE) |
1597 for f in input_api.AffectedFiles(include_deletes=False): | 1598 for f in input_api.AffectedFiles(include_deletes=False): |
| 1599 if (f.LocalPath().startswith('third_party') and |
| 1600 not f.LocalPath().startswith('third_party/WebKit') and |
| 1601 not f.LocalPath().startswith('third_party\\WebKit')): |
| 1602 continue |
| 1603 |
1598 if not f.LocalPath().endswith('.h'): | 1604 if not f.LocalPath().endswith('.h'): |
1599 continue | 1605 continue |
1600 | 1606 |
1601 contents = input_api.ReadFile(f) | 1607 contents = input_api.ReadFile(f) |
1602 fwd_decls = input_api.re.findall(class_pattern, contents) | 1608 fwd_decls = input_api.re.findall(class_pattern, contents) |
1603 fwd_decls.extend(input_api.re.findall(struct_pattern, contents)) | 1609 fwd_decls.extend(input_api.re.findall(struct_pattern, contents)) |
1604 | 1610 |
1605 useless_fwd_decls = [] | 1611 useless_fwd_decls = [] |
1606 for decl in fwd_decls: | 1612 for decl in fwd_decls: |
1607 count = sum(1 for _ in input_api.re.finditer( | 1613 count = sum(1 for _ in input_api.re.finditer( |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2328 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
2323 input_api, | 2329 input_api, |
2324 output_api, | 2330 output_api, |
2325 json_url='http://chromium-status.appspot.com/current?format=json')) | 2331 json_url='http://chromium-status.appspot.com/current?format=json')) |
2326 | 2332 |
2327 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2333 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
2328 input_api, output_api)) | 2334 input_api, output_api)) |
2329 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2335 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
2330 input_api, output_api)) | 2336 input_api, output_api)) |
2331 return results | 2337 return results |
OLD | NEW |