| 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 r"^remoting[\\\/]base[\\\/]logging\.h$", | 1002 r"^remoting[\\\/]base[\\\/]logging\.h$", |
| 1003 r"^remoting[\\\/]host[\\\/].*", | 1003 r"^remoting[\\\/]host[\\\/].*", |
| 1004 r"^sandbox[\\\/]linux[\\\/].*", | 1004 r"^sandbox[\\\/]linux[\\\/].*", |
| 1005 r"^tools[\\\/]", | 1005 r"^tools[\\\/]", |
| 1006 r"^ui[\\\/]aura[\\\/]bench[\\\/]bench_main\.cc$", | 1006 r"^ui[\\\/]aura[\\\/]bench[\\\/]bench_main\.cc$", |
| 1007 r"^webkit[\\\/]browser[\\\/]fileapi[\\\/]" + | 1007 r"^webkit[\\\/]browser[\\\/]fileapi[\\\/]" + |
| 1008 r"dump_file_system.cc$",)) | 1008 r"dump_file_system.cc$",)) |
| 1009 source_file_filter = lambda x: input_api.FilterSourceFile( | 1009 source_file_filter = lambda x: input_api.FilterSourceFile( |
| 1010 x, white_list=(file_inclusion_pattern,), black_list=black_list) | 1010 x, white_list=(file_inclusion_pattern,), black_list=black_list) |
| 1011 | 1011 |
| 1012 log_macro = input_api.re.compile(r"\bD?LOG\s*\(\s*INFO\s*\)") |
| 1013 log_if_macro = input_api.re.compile(r"\bD?LOG_IF\s*\(\s*INFO\s*,") |
| 1014 printf_macro = input_api.re.compile(r"\bprintf\(") |
| 1015 fprintf_macro = input_api.re.compile(r"\bfprintf\((stdout|stderr)") |
| 1016 |
| 1012 log_info = [] | 1017 log_info = [] |
| 1013 printf = [] | 1018 printf = [] |
| 1014 | 1019 |
| 1015 for f in input_api.AffectedSourceFiles(source_file_filter): | 1020 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 1016 contents = input_api.ReadFile(f, 'rb') | 1021 for linenum, line in f.ChangedContents(): |
| 1017 if input_api.re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents): | 1022 if log_macro.search(line) or log_if_macro.search(line): |
| 1018 log_info.append(f.LocalPath()) | 1023 log_info.append(f.LocalPath()) |
| 1019 elif input_api.re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents): | 1024 if printf_macro.search(line) or fprintf_macro.search(line): |
| 1020 log_info.append(f.LocalPath()) | 1025 printf.append(f.LocalPath()) |
| 1021 | |
| 1022 if input_api.re.search(r"\bprintf\(", contents): | |
| 1023 printf.append(f.LocalPath()) | |
| 1024 elif input_api.re.search(r"\bfprintf\((stdout|stderr)", contents): | |
| 1025 printf.append(f.LocalPath()) | |
| 1026 | 1026 |
| 1027 if log_info: | 1027 if log_info: |
| 1028 return [output_api.PresubmitError( | 1028 return [output_api.PresubmitError( |
| 1029 'These files spam the console log with LOG(INFO):', | 1029 'These files spam the console log with LOG(INFO):', |
| 1030 items=log_info)] | 1030 items=log_info)] |
| 1031 if printf: | 1031 if printf: |
| 1032 return [output_api.PresubmitError( | 1032 return [output_api.PresubmitError( |
| 1033 'These files spam the console log with printf/fprintf:', | 1033 'These files spam the console log with printf/fprintf:', |
| 1034 items=printf)] | 1034 items=printf)] |
| 1035 return [] | 1035 return [] |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 builders = [ | 1597 builders = [ |
| 1598 'Mojo Linux Try', | 1598 'Mojo Linux Try', |
| 1599 'Mojo Linux (dbg) Try', | 1599 'Mojo Linux (dbg) Try', |
| 1600 'Mojo Android Builder Try', | 1600 'Mojo Android Builder Try', |
| 1601 'Mojo Android Builder (dbg) Try', | 1601 'Mojo Android Builder (dbg) Try', |
| 1602 'Mojo ChromeOS Builder Try', | 1602 'Mojo ChromeOS Builder Try', |
| 1603 'Mojo ChromeOS Builder (dbg) Try', | 1603 'Mojo ChromeOS Builder (dbg) Try', |
| 1604 ] | 1604 ] |
| 1605 | 1605 |
| 1606 return GetDefaultTryConfigs(builders) | 1606 return GetDefaultTryConfigs(builders) |
| OLD | NEW |