Improve Android log tag presubmit.
Remove reference to a former engineer (the linked doc is sufficient) and
broaden the regex for recognising TAG declarations to also find cases
where the field is not private, as a number of these exist in the code.
Change-Id: If5b8c4e542b06881fc073ffcb1849d9ee70acd24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1873362
Auto-Submit: Richard Coles <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Commit-Queue: Richard Coles <[email protected]>
Cr-Commit-Position: refs/heads/master@{#708359}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 9bbb4f6b..e67a8c2 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -3123,11 +3123,9 @@
# Extract the tag from lines like `Log.d(TAG, "*");` or `Log.d("TAG", "*");`
log_call_pattern = input_api.re.compile(r'^\s*Log\.\w\((?P<tag>\"?\w+\"?)\,')
log_decl_pattern = input_api.re.compile(
- r'^\s*private static final String TAG = "(?P<name>(.*))";',
- input_api.re.MULTILINE)
+ r'static final String TAG = "(?P<name>(.*))"')
- REF_MSG = ('See docs/android_logging.md '
- 'or contact [email protected] for more info.')
+ REF_MSG = ('See docs/android_logging.md for more info.')
sources = lambda x: input_api.FilterSourceFile(x, white_list=[r'.*\.java$'],
black_list=cr_log_check_excluded_paths)