Commit 9b9b94c4 authored by Dave Schuyler's avatar Dave Schuyler Committed by Commit Bot

[presub] lstrip line limit exceptions; ignore <g and <path

Previously, the <link lines in HTML are allowed to have longer than 80 characters.
This CL adds <g and <path to the HTML lines that may have unlimited characters.
(These g and path tags are used in svg image data).
These HTML exemptions also have a trailing space. The space is intended to reduce
false-positives in matching. There are some occurrences of these tags followed by a 
\n which will not match (but the line ends there, so it's not an issue).

These new tags may be preceded by blank space so .lstrip() was added to
the test. I believe this .lstrip() should not be an issue for the other
languages and exemptions present.

Bug: None
Change-Id: Ie9c2bca0e7147033e360ddcfc6eee3b73e167228
Reviewed-on: https://chromium-review.googlesource.com/477371Reviewed-by: 's avatarMarc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Dave Schuyler <dschuyler@chromium.org>
parent cc458639
......@@ -361,7 +361,7 @@ def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None):
CPP_FILE_EXTS = ('c', 'cc')
CPP_EXCEPTIONS = ('#define', '#endif', '#if', '#include', '#pragma')
HTML_FILE_EXTS = ('html',)
HTML_EXCEPTIONS = ('<link',)
HTML_EXCEPTIONS = ('<g ', '<link ', '<path ',)
JAVA_FILE_EXTS = ('java',)
JAVA_EXCEPTIONS = ('import ', 'package ')
JS_FILE_EXTS = ('js',)
......@@ -383,7 +383,7 @@ def CheckLongLines(input_api, output_api, maxlen, source_file_filter=None):
def no_long_lines(file_extension, line):
# Check for language specific exceptions.
if any(file_extension in exts and line.startswith(exceptions)
if any(file_extension in exts and line.lstrip().startswith(exceptions)
for exts, exceptions in LANGUAGE_EXCEPTIONS):
return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment