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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 '*_messages*.h', | 1450 '*_messages*.h', |
1451 '*_param_traits*.*', | 1451 '*_param_traits*.*', |
1452 '*.mojom', | 1452 '*.mojom', |
1453 '*_struct_traits*.*', | 1453 '*_struct_traits*.*', |
1454 '*_type_converter*.*', | 1454 '*_type_converter*.*', |
1455 # Blink uses a different file naming convention | 1455 # Blink uses a different file naming convention |
1456 '*StructTraits*.*', | 1456 '*StructTraits*.*', |
1457 '*TypeConverter*.*', | 1457 '*TypeConverter*.*', |
1458 ] | 1458 ] |
1459 | 1459 |
| 1460 # These third_party directories do not contain IPCs, but contain files |
| 1461 # matching the above patterns, which trigger false positives. |
| 1462 exclude_paths = [ |
| 1463 'third_party/crashpad/*', |
| 1464 ] |
| 1465 |
1460 # Dictionary mapping an OWNERS file path to Patterns. | 1466 # Dictionary mapping an OWNERS file path to Patterns. |
1461 # Patterns is a dictionary mapping glob patterns (suitable for use in per-file | 1467 # Patterns is a dictionary mapping glob patterns (suitable for use in per-file |
1462 # rules ) to a PatternEntry. | 1468 # rules ) to a PatternEntry. |
1463 # PatternEntry is a dictionary with two keys: | 1469 # PatternEntry is a dictionary with two keys: |
1464 # - 'files': the files that are matched by this pattern | 1470 # - 'files': the files that are matched by this pattern |
1465 # - 'rules': the per-file rules needed for this pattern | 1471 # - 'rules': the per-file rules needed for this pattern |
1466 # For example, if we expect OWNERS file to contain rules for *.mojom and | 1472 # For example, if we expect OWNERS file to contain rules for *.mojom and |
1467 # *_struct_traits*.*, Patterns might look like this: | 1473 # *_struct_traits*.*, Patterns might look like this: |
1468 # { | 1474 # { |
1469 # '*.mojom': { | 1475 # '*.mojom': { |
(...skipping 15 matching lines...) Expand all Loading... |
1485 | 1491 |
1486 # Iterate through the affected files to see what we actually need to check | 1492 # Iterate through the affected files to see what we actually need to check |
1487 # for. We should only nag patch authors about per-file rules if a file in that | 1493 # for. We should only nag patch authors about per-file rules if a file in that |
1488 # directory would match that pattern. If a directory only contains *.mojom | 1494 # directory would match that pattern. If a directory only contains *.mojom |
1489 # files and no *_messages*.h files, we should only nag about rules for | 1495 # files and no *_messages*.h files, we should only nag about rules for |
1490 # *.mojom files. | 1496 # *.mojom files. |
1491 for f in input_api.change.AffectedFiles(include_deletes=False): | 1497 for f in input_api.change.AffectedFiles(include_deletes=False): |
1492 for pattern in file_patterns: | 1498 for pattern in file_patterns: |
1493 if input_api.fnmatch.fnmatch( | 1499 if input_api.fnmatch.fnmatch( |
1494 input_api.os_path.basename(f.LocalPath()), pattern): | 1500 input_api.os_path.basename(f.LocalPath()), pattern): |
| 1501 skip = False |
| 1502 for exclude in exclude_paths: |
| 1503 if input_api.fnmatch.fnmatch(f.LocalPath(), exclude): |
| 1504 skip = True |
| 1505 break |
| 1506 if skip: |
| 1507 continue |
1495 owners_file = input_api.os_path.join( | 1508 owners_file = input_api.os_path.join( |
1496 input_api.os_path.dirname(f.LocalPath()), 'OWNERS') | 1509 input_api.os_path.dirname(f.LocalPath()), 'OWNERS') |
1497 if owners_file not in to_check: | 1510 if owners_file not in to_check: |
1498 to_check[owners_file] = {} | 1511 to_check[owners_file] = {} |
1499 if pattern not in to_check[owners_file]: | 1512 if pattern not in to_check[owners_file]: |
1500 to_check[owners_file][pattern] = { | 1513 to_check[owners_file][pattern] = { |
1501 'files': [], | 1514 'files': [], |
1502 'rules': [ | 1515 'rules': [ |
1503 'per-file %s=set noparent' % pattern, | 1516 'per-file %s=set noparent' % pattern, |
1504 'per-file %s=file://ipc/SECURITY_OWNERS' % pattern, | 1517 'per-file %s=file://ipc/SECURITY_OWNERS' % pattern, |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 2302 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
2290 input_api, | 2303 input_api, |
2291 output_api, | 2304 output_api, |
2292 json_url='http://chromium-status.appspot.com/current?format=json')) | 2305 json_url='http://chromium-status.appspot.com/current?format=json')) |
2293 | 2306 |
2294 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 2307 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
2295 input_api, output_api)) | 2308 input_api, output_api)) |
2296 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 2309 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
2297 input_api, output_api)) | 2310 input_api, output_api)) |
2298 return results | 2311 return results |
OLD | NEW |