PRESUBMIT: Skip TODO(crbug.com/ pattern for upload warning
This CL admits the TODO(crbug.com/...) format for bug
references in the code base and avoids the presubmit
warning in those cases. This pattern is pervasive and
even necessary in some folders (e.g. ios/) so, although
it isn't linkified by cs.chromium.org, it's accepted.
Change-Id: Ifb6eda7967271acf76ddfb5fa555ed60f9bce415
Reviewed-on: https://chromium-review.googlesource.com/833203
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Sylvain Defresne <[email protected]>
Commit-Queue: Miguel Casas <[email protected]>
Cr-Commit-Position: refs/heads/master@{#525052}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index b3f9a99f..3dec54d 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -2762,17 +2762,20 @@
def _CheckCrbugLinksHaveHttps(input_api, output_api):
- """Checks that crbug(.com) links are correctly prefixed by https://"""
+ """Checks that crbug(.com) links are correctly prefixed by https://,
+ unless they come in the accepted form TODO(crbug.com/...)
+ """
white_list = r'.+%s' % _IMPLEMENTATION_EXTENSIONS
black_list = (_EXCLUDED_PATHS + _TEST_CODE_EXCLUDED_PATHS)
sources = lambda f: input_api.FilterSourceFile(
f, white_list=white_list, black_list=black_list)
pattern = input_api.re.compile(r'//.*(?<!:\/\/)crbug[.com]*')
+ accepted_pattern = input_api.re.compile(r'//.*TODO\(crbug[.com]*');
problems = []
for f in input_api.AffectedSourceFiles(sources):
for line_num, line in f.ChangedContents():
- if pattern.search(line):
+ if pattern.search(line) and not accepted_pattern.search(line):
problems.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
if problems: