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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 Each region separated by #if, #elif, #else, #endif, #define and #undef follows | 820 Each region separated by #if, #elif, #else, #endif, #define and #undef follows |
821 these rules separately. | 821 these rules separately. |
822 """ | 822 """ |
823 def FileFilterIncludeOrder(affected_file): | 823 def FileFilterIncludeOrder(affected_file): |
824 black_list = (_EXCLUDED_PATHS + input_api.DEFAULT_BLACK_LIST) | 824 black_list = (_EXCLUDED_PATHS + input_api.DEFAULT_BLACK_LIST) |
825 return input_api.FilterSourceFile(affected_file, black_list=black_list) | 825 return input_api.FilterSourceFile(affected_file, black_list=black_list) |
826 | 826 |
827 warnings = [] | 827 warnings = [] |
828 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): | 828 for f in input_api.AffectedFiles(file_filter=FileFilterIncludeOrder): |
829 if f.LocalPath().endswith(('.cc', '.h')): | 829 if f.LocalPath().endswith(('.cc', '.h', '.mm')): |
830 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) | 830 changed_linenums = set(line_num for line_num, _ in f.ChangedContents()) |
831 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) | 831 warnings.extend(_CheckIncludeOrderInFile(input_api, f, changed_linenums)) |
832 | 832 |
833 results = [] | 833 results = [] |
834 if warnings: | 834 if warnings: |
835 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, | 835 results.append(output_api.PresubmitPromptOrNotify(_INCLUDE_ORDER_WARNING, |
836 warnings)) | 836 warnings)) |
837 return results | 837 return results |
838 | 838 |
839 | 839 |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 # Explicitly iterate over copies of dicts since we mutate them. | 1803 # Explicitly iterate over copies of dicts since we mutate them. |
1804 for master in builders.keys(): | 1804 for master in builders.keys(): |
1805 for builder in builders[master].keys(): | 1805 for builder in builders[master].keys(): |
1806 # Do not trigger presubmit builders, since they're likely to fail | 1806 # Do not trigger presubmit builders, since they're likely to fail |
1807 # (e.g. OWNERS checks before finished code review), and we're | 1807 # (e.g. OWNERS checks before finished code review), and we're |
1808 # running local presubmit anyway. | 1808 # running local presubmit anyway. |
1809 if 'presubmit' in builder: | 1809 if 'presubmit' in builder: |
1810 builders[master].pop(builder) | 1810 builders[master].pop(builder) |
1811 | 1811 |
1812 return builders | 1812 return builders |
OLD | NEW |