diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 878ee70a68..10a8d273d6 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -359,7 +359,7 @@ def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None): return False return ( - any((url in line) for url in ('http://', 'https://')) or + any((url in line) for url in ('file://', 'http://', 'https://')) or input_api.re.match( r'.*[A-Za-z][A-Za-z_0-9]{%d,}.*' % long_symbol, line)) diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index d97e7fa7aa..474d6fa007 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -2235,6 +2235,17 @@ class CannedChecksUnittest(PresubmitTestsBase): None, presubmit.OutputApi.PresubmitPromptWarning) + def testCannedCheckLongLinesFile(self): + check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) + self.ContentTest( + check, + ' file:// 0 23 5', + None, + ' file:// 0 23 56', + None, + presubmit.OutputApi.PresubmitPromptWarning) + + def testCannedCheckLongLinesLongSymbol(self): check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) self.ContentTest(