[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/477371
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Dave Schuyler <dschuyler@chromium.org>
changes/71/477371/4
Dave Schuyler 8 years ago committed by Commit Bot
parent cc45863958
commit 9b9b94c412

@ -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

Loading…
Cancel
Save