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 gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 return output_list | 877 return output_list |
| 878 | 878 |
| 879 return [] | 879 return [] |
| 880 | 880 |
| 881 | 881 |
| 882 def _CheckSpamLogging(input_api, output_api): | 882 def _CheckSpamLogging(input_api, output_api): |
| 883 file_inclusion_pattern = r'.+%s' % _IMPLEMENTATION_EXTENSIONS | 883 file_inclusion_pattern = r'.+%s' % _IMPLEMENTATION_EXTENSIONS |
| 884 black_list = (_EXCLUDED_PATHS + | 884 black_list = (_EXCLUDED_PATHS + |
| 885 _TEST_CODE_EXCLUDED_PATHS + | 885 _TEST_CODE_EXCLUDED_PATHS + |
| 886 input_api.DEFAULT_BLACK_LIST + | 886 input_api.DEFAULT_BLACK_LIST + |
| 887 (r"^base[\\\/]logging\.h$", | 887 (r"^base/logging\.h$", |
| 888 r"^base[\\\/]logging\.cc$", | 888 r"^base/logging\.cc$", |
| 889 r"^shell[\\\/]native_application_loader\.cc$", | 889 r"^shell/application_manager/network_fetcher\.cc$", |
| 890 r"^sandbox[\\\/]linux[\\\/].*", | 890 r"^shell/tracer\.cc$", |
| 891 r"^tools[\\\/]", | 891 r"^sandbox/linux/.*", |
| 892 r"^ui[\\\/]aura[\\\/]bench[\\\/]bench_main\.cc$",)) | 892 r"^tools/")) |
| 893 source_file_filter = lambda x: input_api.FilterSourceFile( | 893 source_file_filter = lambda x: input_api.FilterSourceFile( |
| 894 x, white_list=(file_inclusion_pattern,), black_list=black_list) | 894 x, white_list=(file_inclusion_pattern,), black_list=black_list) |
| 895 | 895 |
| 896 log_macro = input_api.re.compile(r"\bD?LOG\s*\(\s*INFO\s*\)") | 896 log_macro = input_api.re.compile(r"\bD?LOG\s*\(\s*INFO\s*\)") |
| 897 log_if_macro = input_api.re.compile(r"\bD?LOG_IF\s*\(\s*INFO\s*,") | 897 log_if_macro = input_api.re.compile(r"\bD?LOG_IF\s*\(\s*INFO\s*,") |
| 898 printf_macro = input_api.re.compile(r"\bprintf\(") | 898 printf_macro = input_api.re.compile(r"\bprintf\(") |
| 899 fprintf_macro = input_api.re.compile(r"\bfprintf\((stdout|stderr)") | 899 fprintf_macro = input_api.re.compile(r"\bfprintf\((stdout|stderr)") |
| 900 | 900 |
| 901 log_info = [] | 901 log_info = [] |
| 902 printf = [] | 902 printf = [] |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1018 action = 'name="{0}"'.format(action_name) | 1018 action = 'name="{0}"'.format(action_name) |
| 1019 if action not in current_actions: | 1019 if action not in current_actions: |
| 1020 return [output_api.PresubmitPromptWarning( | 1020 return [output_api.PresubmitPromptWarning( |
| 1021 'File %s line %d: %s is missing in ' | 1021 'File %s line %d: %s is missing in ' |
| 1022 'tools/metrics/actions/actions.xml. Please run ' | 1022 'tools/metrics/actions/actions.xml. Please run ' |
| 1023 'tools/metrics/actions/extract_actions.py to update.' | 1023 'tools/metrics/actions/extract_actions.py to update.' |
| 1024 % (f.LocalPath(), line_num, action_name))] | 1024 % (f.LocalPath(), line_num, action_name))] |
| 1025 return [] | 1025 return [] |
| 1026 | 1026 |
| 1027 | 1027 |
| 1028 def _GetJSONParseError(input_api, filename, eat_comments=True): | 1028 def _GetJSONParseError(input_api, filename, eat_comments=True): |
|
viettrungluu
2015/04/07 22:05:44
Remove the eat_comments arg?
| |
| 1029 try: | 1029 try: |
| 1030 contents = input_api.ReadFile(filename) | 1030 contents = input_api.ReadFile(filename) |
| 1031 if eat_comments: | |
| 1032 json_comment_eater = input_api.os_path.join( | |
| 1033 input_api.PresubmitLocalPath(), | |
| 1034 'tools', 'json_comment_eater', 'json_comment_eater.py') | |
| 1035 process = input_api.subprocess.Popen( | |
| 1036 [input_api.python_executable, json_comment_eater], | |
| 1037 stdin=input_api.subprocess.PIPE, | |
| 1038 stdout=input_api.subprocess.PIPE, | |
| 1039 universal_newlines=True) | |
| 1040 (contents, _) = process.communicate(input=contents) | |
| 1041 | |
| 1042 input_api.json.loads(contents) | 1031 input_api.json.loads(contents) |
| 1043 except ValueError as e: | 1032 except ValueError as e: |
| 1044 return e | 1033 return e |
| 1045 return None | 1034 return None |
| 1046 | 1035 |
| 1047 | 1036 |
| 1048 def _CheckParseErrors(input_api, output_api): | 1037 def _CheckParseErrors(input_api, output_api): |
| 1049 """Check that JSON files do not contain syntax errors.""" | 1038 """Check that JSON files do not contain syntax errors.""" |
| 1050 actions = { | 1039 actions = { |
| 1051 '.json': _GetJSONParseError, | 1040 '.json': _GetJSONParseError, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 'Mojo ChromeOS Builder (dbg) Try', | 1474 'Mojo ChromeOS Builder (dbg) Try', |
| 1486 'Mojo ChromeOS Builder Try', | 1475 'Mojo ChromeOS Builder Try', |
| 1487 'Mojo Linux (dbg) Try', | 1476 'Mojo Linux (dbg) Try', |
| 1488 'Mojo Linux ASan Try', | 1477 'Mojo Linux ASan Try', |
| 1489 'Mojo Linux NaCl (dbg) Try', | 1478 'Mojo Linux NaCl (dbg) Try', |
| 1490 'Mojo Linux NaCl Try', | 1479 'Mojo Linux NaCl Try', |
| 1491 'Mojo Linux Try', | 1480 'Mojo Linux Try', |
| 1492 ] | 1481 ] |
| 1493 | 1482 |
| 1494 return GetDefaultTryConfigs(builders) | 1483 return GetDefaultTryConfigs(builders) |
| OLD | NEW |