Skip to content
Snippets Groups Projects
Unverified Commit b0be5f2d authored by Max Gautier's avatar Max Gautier Committed by GitHub
Browse files

Print the name of faulty jinja templates in pre-commit (#11484)

parent 27c7dc70
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import sys
import traceback
from jinja2 import Environment
from jinja2.exceptions import TemplateSyntaxError
env = Environment()
errors = False
for template in sys.argv[1:]:
with open(template) as t:
env.parse(t.read())
try:
with open(template) as t:
env.parse(t.read())
except TemplateSyntaxError as e:
print (template)
traceback.print_exc()
errors = True
if errors:
exit (1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment