mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-01 10:24:45 +00:00
parent
90f023d325
commit
e23ee4627d
2 changed files with 12 additions and 1 deletions
|
|
@ -26,7 +26,7 @@
|
||||||
message: Double quotes should be used in tags.
|
message: Double quotes should be used in tags.
|
||||||
flags: re.DOTALL
|
flags: re.DOTALL
|
||||||
patterns:
|
patterns:
|
||||||
- "{%[ \t]*?(?:trans(?:late)?|with|extends|include|now)?[ \t]+?(?:[^']+?=)?'[^']*?'(?:(?!%}).)*?%}"
|
- "{%[ \t]*?(?:trans(?:late)?|with|extends|include|now)[\\s]+?(?:[^']+?=)?'[^']*?'(?:(?!%}).)*?%}"
|
||||||
- rule:
|
- rule:
|
||||||
name: T003
|
name: T003
|
||||||
message: 'Endblock should have name. Ex: {% endblock body %}.'
|
message: 'Endblock should have name. Ex: {% endblock body %}.'
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,17 @@ def test_T002(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||||
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
|
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
|
||||||
assert "T002" not in result.output
|
assert "T002" not in result.output
|
||||||
|
|
||||||
|
# verify regex doesn't match other stuff
|
||||||
|
write_to_file(
|
||||||
|
tmp_file.name,
|
||||||
|
b"""{% if form.action_url %}
|
||||||
|
='stuff'
|
||||||
|
{% endif %}
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
result = runner.invoke(djlint, [tmp_file.name, "--profile", "django"])
|
||||||
|
assert "T002" not in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_T003(runner: CliRunner, tmp_file: TextIO) -> None:
|
def test_T003(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||||
write_to_file(tmp_file.name, b"{% endblock %}")
|
write_to_file(tmp_file.name, b"{% endblock %}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue