Check more html files in check-templates.

Instead of just checking .html files in the templates directory,
we now also check them everywhere, including .html files used
for Casper tests and some static files.
This commit is contained in:
Steve Howell 2016-07-08 17:43:32 -07:00 committed by Tim Abbott
parent 494ea4a4f4
commit 538bc61c54
1 changed files with 7 additions and 8 deletions

View File

@ -192,7 +192,7 @@ def check_our_files():
group_by_ftype=True) group_by_ftype=True)
check_handlebar_templates(by_lang['handlebars'], options.modified) check_handlebar_templates(by_lang['handlebars'], options.modified)
check_django_templates(by_lang['html'], options.modified) check_html_templates(by_lang['html'], options.modified)
def check_handlebar_templates(templates, modified_only): def check_handlebar_templates(templates, modified_only):
# Check all our handlebars templates. # Check all our handlebars templates.
@ -202,13 +202,12 @@ def check_handlebar_templates(templates, modified_only):
for fn in templates: for fn in templates:
validate(fn, check_indent=True) validate(fn, check_indent=True)
def check_django_templates(templates, modified_only): def check_html_templates(templates, modified_only):
def ok(fn): # Our files with .html extensions are usually for Django, but we also
if 'templates' not in fn: return False # have some for Casper tests and a few static ones.
if 'base.html' in fn: return False # The file base.html has a bit of funny HTML that we can't parse here yet.
return True templates = filter(lambda fn: 'base.html' not in fn, templates)
templates = sorted(list(templates))
templates = sorted(list(filter(ok, templates)))
if not modified_only: if not modified_only:
assert len(templates) >= 10 # sanity check that we are actually doing work assert len(templates) >= 10 # sanity check that we are actually doing work