mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-16 17:11:08 +00:00
fixed #148, added test
This commit is contained in:
parent
9fcf251ac5
commit
3281b55f61
2 changed files with 8 additions and 3 deletions
|
|
@ -209,8 +209,8 @@
|
|||
exclude:
|
||||
- django
|
||||
patterns:
|
||||
- <(?:/?(?:\w+)\b(?:\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}/])*=([\"'])(?:(?!\1).)*?({%)[^-])\s*?(?:if|for|else|end)
|
||||
- <(?:/?(?:\w+)\b(?:\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}/])*=([\"'])(?:(?!\1).)*?{%(?:(?!%}).)*(?:if|else|for|end)(?:(?!%}).)*[^-](%}))
|
||||
- <(?:/?(?:\w+)\b(?:\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}/])*(?<!\bclass)=([\"'])(?:(?!\1).)*?({%)[^-])\s*?(?:if|for|else|end)
|
||||
- <(?:/?(?:\w+)\b(?:\"[^\"]*\"|'[^']*'|{[^}]*}|[^'\">{}/])*(?<!\bclass)=([\"'])(?:(?!\1).)*?{%(?:(?!%}).)*(?:if|else|for|end)(?:(?!%}).)*[^-](%}))
|
||||
- rule:
|
||||
name: H029
|
||||
message: Consider using lowercase form method values.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ run::
|
|||
|
||||
# for a single test
|
||||
|
||||
pytest tests/test_linter.py::test_H025 --cov=src/djlint --cov-branch \
|
||||
pytest tests/test_linter.py::test_T028 --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
"""
|
||||
|
|
@ -520,6 +520,11 @@ def test_T028(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert "T028" not in result.output
|
||||
|
||||
# class should not trigger
|
||||
write_to_file(tmp_file.name, b'<input class="{% if %}{% endif %}" />')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert "T028" not in result.output
|
||||
|
||||
|
||||
def test_H029(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b'<forM method="Post">')
|
||||
|
|
|
|||
Loading…
Reference in a new issue