Commit e9c06814 authored by dbeam's avatar dbeam Committed by Commit bot

web_dev_style: enhance <include> presubmit to account for

<include src="..."/>
<include src="..." />

R=tbreisacher@chromium.org
BUG=393873
NOTRY=true

Review URL: https://codereview.chromium.org/585053003

Cr-Commit-Position: refs/heads/master@{#295796}
parent 7925c346
......@@ -42,7 +42,8 @@ class ResourceStyleGuideTest(SuperMoxTestBase):
error = self.checker.IncludeCheck(1, line)
self.assertNotEqual('', error,
'Should be flagged as style error: ' + line)
self.assertEqual(GetHighlight(line, error), '</include>')
highlight = GetHighlight(line, error).strip()
self.assertTrue('include' in highlight and highlight[0] == '<')
def ShouldPassIncludeCheck(self, line):
"""Checks that the '</include>' checker doesn't flag |line| as an error."""
......@@ -54,6 +55,8 @@ class ResourceStyleGuideTest(SuperMoxTestBase):
"</include> ",
" </include>",
" </include> ",
' <include src="blah.js" /> ',
'<include src="blee.js"/>',
]
for line in lines:
self.ShouldFailIncludeCheck(line)
......
......@@ -17,7 +17,7 @@ class ResourceChecker(object):
def IncludeCheck(self, line_number, line):
return regex_check.RegexCheck(self.input_api.re, line_number, line,
"(</include>)", "</include> is unnecessary. Please remove.")
"(</include>|<include.*/>)", "Closing <include> tags is unnecessary.")
def RunChecks(self):
"""Check for violations of the Chromium web development style guide. See
......
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