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 #!/usr/bin/env python
import sys import sys
import traceback
from jinja2 import Environment from jinja2 import Environment
from jinja2.exceptions import TemplateSyntaxError
env = Environment() env = Environment()
errors = False
for template in sys.argv[1:]: for template in sys.argv[1:]:
with open(template) as t: try:
env.parse(t.read()) 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.
Please register or to comment