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 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1578 | 1578 |
| 1579 if len(files): | 1579 if len(files): |
| 1580 return [output_api.PresubmitError( | 1580 return [output_api.PresubmitError( |
| 1581 'Do not introduce new mojom targets with use_new_wrapper_types set to ' | 1581 'Do not introduce new mojom targets with use_new_wrapper_types set to ' |
| 1582 'false. The mode is deprecated and will be removed soon.', | 1582 'false. The mode is deprecated and will be removed soon.', |
| 1583 files)] | 1583 files)] |
| 1584 return [] | 1584 return [] |
| 1585 | 1585 |
| 1586 | 1586 |
| 1587 def _CheckUselessForwardDeclarations(input_api, output_api): | 1587 def _CheckUselessForwardDeclarations(input_api, output_api): |
| 1588 """Checks that added or removed lines in affected header files | 1588 """Checks that added or removed lines in non third party affected |
| 1589 do not lead to new useless class or struct forward declaration. | 1589 header files do not lead to new useless class or struct forward |
| 1590 declaration. | |
| 1590 """ | 1591 """ |
| 1591 results = [] | 1592 results = [] |
| 1592 class_pattern = input_api.re.compile(r'^class\s+(\w+);$', | 1593 class_pattern = input_api.re.compile(r'^class\s+(\w+);$', |
| 1593 input_api.re.MULTILINE) | 1594 input_api.re.MULTILINE) |
| 1594 struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$', | 1595 struct_pattern = input_api.re.compile(r'^struct\s+(\w+);$', |
| 1595 input_api.re.MULTILINE) | 1596 input_api.re.MULTILINE) |
| 1596 for f in input_api.AffectedFiles(include_deletes=False): | 1597 for f in input_api.AffectedFiles(include_deletes=False): |
| 1598 if (f.LocalPath().startswith('third_party') and | |
| 1599 not f.LocalPath().startswith('third_party/WebKit') and | |
| 1600 not f.LocalPath().startswith('third_party\WebKit')): | |
|
jochen (gone - plz use gerrit)
2016/12/12 07:42:02
I think you have to escape the backslash
jbriance
2016/12/12 08:07:42
Indeed, I'll fix.
| |
| 1601 continue | |
| 1602 | |
| 1597 if not f.LocalPath().endswith('.h'): | 1603 if not f.LocalPath().endswith('.h'): |
| 1598 continue | 1604 continue |
| 1599 | 1605 |
| 1600 contents = input_api.ReadFile(f) | 1606 contents = input_api.ReadFile(f) |
| 1601 fwd_decls = input_api.re.findall(class_pattern, contents) | 1607 fwd_decls = input_api.re.findall(class_pattern, contents) |
| 1602 fwd_decls.extend(input_api.re.findall(struct_pattern, contents)) | 1608 fwd_decls.extend(input_api.re.findall(struct_pattern, contents)) |
| 1603 | 1609 |
| 1604 useless_fwd_decls = [] | 1610 useless_fwd_decls = [] |
| 1605 for decl in fwd_decls: | 1611 for decl in fwd_decls: |
| 1606 count = sum(1 for _ in input_api.re.finditer( | 1612 count = sum(1 for _ in input_api.re.finditer( |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2321 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2327 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 2322 input_api, | 2328 input_api, |
| 2323 output_api, | 2329 output_api, |
| 2324 json_url='http://chromium-status.appspot.com/current?format=json')) | 2330 json_url='http://chromium-status.appspot.com/current?format=json')) |
| 2325 | 2331 |
| 2326 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2332 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 2327 input_api, output_api)) | 2333 input_api, output_api)) |
| 2328 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2334 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 2329 input_api, output_api)) | 2335 input_api, output_api)) |
| 2330 return results | 2336 return results |
| OLD | NEW |