j2lint icon indicating copy to clipboard operation
j2lint copied to clipboard

`jinja-variable-lower-case` wrongly detects escaped strings as variables

Open DeadNews opened this issue 4 months ago • 1 comments

Description

The jinja-variable-lower-case rule in j2lint is incorrectly identifies escaped strings as variables. According to the Jinja2 documentation, these strings should be treated as literal strings, not variables.

Steps to Reproduce

{# test.yml.j2 #}
template: '{{ '{{ ToLower .Value }}' }}'
$ j2lint test.yml.j2
test.yml.j2
├── test.yml.j2:1 All variables should use lower case: '{{ variable }}': ToLower (jinja-variable-lower-case)
└── test.yml.j2:1 All variables should use lower case: '{{ variable }}': Value (jinja-variable-lower-case)

Jinja2 linting finished with 2 error(s) and 0 warning(s)

Context

$ j2lint --version                                               
Jinja2-Linter Version v1.1.0

DeadNews avatar Mar 18 '24 14:03 DeadNews