Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: PRESUBMIT.py

Issue 1980693002: Upstream: Ignore android.util.Log usage in WebAPK code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 errors)) 1432 errors))
1433 1433
1434 return results 1434 return results
1435 1435
1436 1436
1437 def _CheckAndroidCrLogUsage(input_api, output_api): 1437 def _CheckAndroidCrLogUsage(input_api, output_api):
1438 """Checks that new logs using org.chromium.base.Log: 1438 """Checks that new logs using org.chromium.base.Log:
1439 - Are using 'TAG' as variable name for the tags (warn) 1439 - Are using 'TAG' as variable name for the tags (warn)
1440 - Are using a tag that is shorter than 20 characters (error) 1440 - Are using a tag that is shorter than 20 characters (error)
1441 """ 1441 """
1442
1443 # Do not check format of logs in //chrome/android/webapk because
1444 # //chrome/android/webapk cannot depend on //base
1445 cr_log_check_excluded_paths = [
1446 r"^chrome[\\\/]android[\\\/]webapk[\\\/].*",
1447 ]
1448
1442 cr_log_import_pattern = input_api.re.compile( 1449 cr_log_import_pattern = input_api.re.compile(
1443 r'^import org\.chromium\.base\.Log;$', input_api.re.MULTILINE) 1450 r'^import org\.chromium\.base\.Log;$', input_api.re.MULTILINE)
1444 class_in_base_pattern = input_api.re.compile( 1451 class_in_base_pattern = input_api.re.compile(
1445 r'^package org\.chromium\.base;$', input_api.re.MULTILINE) 1452 r'^package org\.chromium\.base;$', input_api.re.MULTILINE)
1446 has_some_log_import_pattern = input_api.re.compile( 1453 has_some_log_import_pattern = input_api.re.compile(
1447 r'^import .*\.Log;$', input_api.re.MULTILINE) 1454 r'^import .*\.Log;$', input_api.re.MULTILINE)
1448 # Extract the tag from lines like `Log.d(TAG, "*");` or `Log.d("TAG", "*");` 1455 # Extract the tag from lines like `Log.d(TAG, "*");` or `Log.d("TAG", "*");`
1449 log_call_pattern = input_api.re.compile(r'^\s*Log\.\w\((?P<tag>\"?\w+\"?)\,') 1456 log_call_pattern = input_api.re.compile(r'^\s*Log\.\w\((?P<tag>\"?\w+\"?)\,')
1450 log_decl_pattern = input_api.re.compile( 1457 log_decl_pattern = input_api.re.compile(
1451 r'^\s*private static final String TAG = "(?P<name>(.*))";', 1458 r'^\s*private static final String TAG = "(?P<name>(.*))";',
1452 input_api.re.MULTILINE) 1459 input_api.re.MULTILINE)
1453 1460
1454 REF_MSG = ('See docs/android_logging.md ' 1461 REF_MSG = ('See docs/android_logging.md '
1455 'or contact dgn@chromium.org for more info.') 1462 'or contact dgn@chromium.org for more info.')
1456 sources = lambda x: input_api.FilterSourceFile(x, white_list=(r'.*\.java$',)) 1463 sources = lambda x: input_api.FilterSourceFile(x, white_list=(r'.*\.java$',),
1464 black_list=cr_log_check_excluded_paths)
1457 1465
1458 tag_decl_errors = [] 1466 tag_decl_errors = []
1459 tag_length_errors = [] 1467 tag_length_errors = []
1460 tag_errors = [] 1468 tag_errors = []
1461 tag_with_dot_errors = [] 1469 tag_with_dot_errors = []
1462 util_log_errors = [] 1470 util_log_errors = []
1463 1471
1464 for f in input_api.AffectedSourceFiles(sources): 1472 for f in input_api.AffectedSourceFiles(sources):
1465 file_content = input_api.ReadFile(f) 1473 file_content = input_api.ReadFile(f)
1466 has_modified_logs = False 1474 has_modified_logs = False
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 results.extend(input_api.canned_checks.CheckTreeIsOpen( 2134 results.extend(input_api.canned_checks.CheckTreeIsOpen(
2127 input_api, 2135 input_api,
2128 output_api, 2136 output_api,
2129 json_url='http://chromium-status.appspot.com/current?format=json')) 2137 json_url='http://chromium-status.appspot.com/current?format=json'))
2130 2138
2131 results.extend(input_api.canned_checks.CheckChangeHasBugField( 2139 results.extend(input_api.canned_checks.CheckChangeHasBugField(
2132 input_api, output_api)) 2140 input_api, output_api))
2133 results.extend(input_api.canned_checks.CheckChangeHasDescription( 2141 results.extend(input_api.canned_checks.CheckChangeHasDescription(
2134 input_api, output_api)) 2142 input_api, output_api))
2135 return results 2143 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698