mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-17 05:50:24 +00:00
fix(linter): fixed false positive on T032 with jinja multi line set
closes #342
This commit is contained in:
parent
af3eb04387
commit
f9dac86b1a
2 changed files with 20 additions and 2 deletions
|
|
@ -242,8 +242,8 @@
|
|||
name: T032
|
||||
message: Extra whitespace found in template tags.
|
||||
patterns:
|
||||
- "{%(([\"|'](?:(?!'|\"|%}).)*?[\"|'])|[^(?:%}|'|\")])*?\\s{2,}"
|
||||
- "{{(([\"|'](?:(?!'|\"|}}).)*?[\"|'])|[^(?:}}|'|\")])*?\\s{2,}"
|
||||
- "{%(([\"|'](?:(?!'|\"|%}).)*?[\"|'])|[^(?:%}|'|\"|\n)])*?[ \t]{2,}"
|
||||
- "{{(([\"|'](?:(?!'|\"|}}).)*?[\"|'])|[^(?:}}|'|\"|\n)])*?[ \t]{2,}"
|
||||
- rule:
|
||||
name: H033
|
||||
message: Extra whitespace found in form action.
|
||||
|
|
|
|||
|
|
@ -715,6 +715,24 @@ def test_T032(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
|
||||
assert "T032" not in result.output
|
||||
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b"""{# [INFO] Simple example #}
|
||||
{% set kira = [
|
||||
'Goddess', 'Genius'
|
||||
] %}
|
||||
|
||||
{# [INFO] Real example #}
|
||||
{% set kira_online_scaners = [
|
||||
('https://quttera.com/sitescan/', 'SashaButtonLightSkyBlue', 'Quttera'),
|
||||
('https://sitecheck.sucuri.net/results/', 'SashaButtonLimeGreen', 'Sucuri'),
|
||||
('https://www.isithacked.com/check/', 'SashaButtonPlum', 'Is It Hacked?'),
|
||||
] %}
|
||||
""",
|
||||
)
|
||||
result = runner.invoke(djlint, [tmp_file.name, "--profile", "jinja"])
|
||||
assert "T032" not in result.output
|
||||
|
||||
|
||||
def test_H033(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(
|
||||
|
|
|
|||
Loading…
Reference in a new issue