Remove PRESUBMIT warning for crbug links without https:// prefix.
This was added in r524073 because code search didn't linkify bare crbug links. But now it does (see crbug.com/762061), so we don't need the extra verbosity. Change-Id: Ia0b2fd66b4717cb9dd87b6e49373918cec729c51 Reviewed-on: https://chromium-review.googlesource.com/1213512 Commit-Queue: Steve Kobes <skobes@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Cr-Commit-Position: refs/heads/master@{#589623}
This commit is contained in:
23
PRESUBMIT.py
23
PRESUBMIT.py
@ -3366,28 +3366,6 @@ def _CheckSyslogUseWarning(input_api, output_api, source_file_filter=None):
|
||||
return []
|
||||
|
||||
|
||||
def _CheckCrbugLinksHaveHttps(input_api, output_api):
|
||||
"""Checks that crbug(.com) links are correctly prefixed by https://,
|
||||
unless they come in the accepted form TODO(crbug.com/...)
|
||||
"""
|
||||
|
||||
# The cr bug strings are split to avoid matching in real presubmit
|
||||
# checkings.
|
||||
pattern = input_api.re.compile(r'//.*(?<!:\/\/)cr''bug[.com]*')
|
||||
accepted_pattern = input_api.re.compile(r'//.*TODO\(cr''bug[.com]*')
|
||||
problems = []
|
||||
for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
|
||||
for line_num, line in f.ChangedContents():
|
||||
if pattern.search(line) and not accepted_pattern.search(line):
|
||||
problems.append(' %s:%d %s' % (f.LocalPath(), line_num, line))
|
||||
|
||||
if problems:
|
||||
return [output_api.PresubmitPromptWarning(
|
||||
'Found unprefixed crbug.com URL(s), consider prepending https://\n' +
|
||||
'\n'.join(problems))]
|
||||
return []
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
results = []
|
||||
results.extend(_CommonChecks(input_api, output_api))
|
||||
@ -3398,7 +3376,6 @@ def CheckChangeOnUpload(input_api, output_api):
|
||||
results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api))
|
||||
results.extend(_CheckSyslogUseWarning(input_api, output_api))
|
||||
results.extend(_CheckGoogleSupportAnswerUrl(input_api, output_api))
|
||||
results.extend(_CheckCrbugLinksHaveHttps(input_api, output_api))
|
||||
results.extend(_CheckUniquePtr(input_api, output_api))
|
||||
results.extend(_CheckNewHeaderWithoutGnChange(input_api, output_api))
|
||||
return results
|
||||
|
@ -1652,40 +1652,6 @@ class MojoManifestOwnerTest(unittest.TestCase):
|
||||
self.assertEqual([], errors)
|
||||
|
||||
|
||||
class CheckCrbugLinksHaveHttpsTest(unittest.TestCase):
|
||||
def assertWarningsWithFile(self, content, expected_warnings, file_name):
|
||||
input_api = MockInputApi()
|
||||
input_api.files = [
|
||||
MockFile(file_name, [content])
|
||||
]
|
||||
|
||||
warnings = PRESUBMIT._CheckCrbugLinksHaveHttps(input_api, MockOutputApi())
|
||||
self.assertEqual(expected_warnings, len(warnings))
|
||||
|
||||
def assertWarnings(self, content, expected_warnings):
|
||||
for f in ['somewhere/file.cc', 'file.java', 'file.py', 'file_test.cc']:
|
||||
self.assertWarningsWithFile(content, expected_warnings, f)
|
||||
|
||||
# The cr bug strings are split to avoid matching in real PRESUBMIT, so meta!
|
||||
def testNoScheme(self):
|
||||
self.assertWarnings('// TODO(dev): cr''bug.com should be linkified', 1)
|
||||
|
||||
def testNoScheme2(self):
|
||||
self.assertWarnings('// TODO(dev): (cr''bug.com) should be linkified', 1)
|
||||
|
||||
def testNoCom(self):
|
||||
self.assertWarnings('// TODO(dev): cr''bug/123 should be well formed', 1)
|
||||
|
||||
def testHttp(self):
|
||||
self.assertWarnings('// TODO(dev): http://cr''bug.com it\'s OK', 0)
|
||||
|
||||
def testHttps(self):
|
||||
self.assertWarnings('// TODO(dev): https://cr''bug.com is just great', 0)
|
||||
|
||||
def testTodo(self):
|
||||
self.assertWarnings('// TODO(cr''bug.com/123456): it\'s also OK', 0)
|
||||
|
||||
|
||||
class BannedFunctionCheckTest(unittest.TestCase):
|
||||
|
||||
def testBannedIosObcjFunctions(self):
|
||||
|
Reference in New Issue
Block a user