Jinja Tip: Validate and check your Jinja templates for syntax errors with j2lint. Ideal for integrating into a CI pipeline.
ā https://github.com/aristanetworks/j2lint
Here is an example below š
$ uv tool install j2lint
$ cat config.j2
hostname
{%for int in interfaces%}
interface
ip address {{int.ip}} {{int.NetMask}}
{%endfor
$ j2lint config.j2
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
JINJA2 LINT ERRORS
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
config.j2
āāā config.j2:1 A single space should be added
ā between Jinja2 curly brackets and a variable
ā name: {{ ethernet_interface }} (single-space...
āāā config.j2:2 Jinja statement should have at
ā least a single space after '{%' and a single
ā space before '%}' (jinja-statements-single-...
āāā config.j2:3 A single space should be added
ā between Jinja2 curly brackets and a variable
ā name: {{ ethernet_interface }} (single-space...
āāā config.j2:4 unexpected '}' (jinja-syntax-error)
āāā config.j2:4 A single space should be added
between Jinja2 curly brackets and a variable
name: {{ ethernet_interface }} (single-space...
Jinja2 linting finished with 5 error(s) and 0 warning(s)