diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 7e01cb8900..95112505aa 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -529,6 +529,7 @@ def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None): ] def no_long_lines(file_extension, line): + """Returns True if the line length is okay.""" # Check for language specific exceptions. if any(file_extension in exts and line.lstrip().startswith(exceptions) for exts, exceptions in LANGUAGE_EXCEPTIONS): @@ -548,6 +549,9 @@ def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None): if any((url in line) for url in ('file://', 'http://', 'https://')): return True + if 'presubmit: ignore-long-line' in line: + return True + if line_len > extra_maxlen: return False