fix(linter): fixed false positive on H017. Added test

closes #406
This commit is contained in:
Christopher Pickering 2022-09-26 08:51:04 +02:00
parent 044cd47515
commit 17ff881045
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
3 changed files with 10 additions and 5 deletions

View file

@ -2,11 +2,11 @@ name: test
on: on:
push: push:
branches: branches:
- 'master' - master
pull_request: pull_request:
branches: branches:
- 'master' - master
- 'dev' - dev
jobs: jobs:
test: test:
@ -47,7 +47,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10', 3.11-dev] python-version: [3.7, 3.8, 3.9, '3.10', 3.11-dev]
node: [ 12, 14, 16 ] node: [12, 14, 16]
fail-fast: true fail-fast: true
steps: steps:

View file

@ -128,7 +128,7 @@
message: Tag should be self closing. message: Tag should be self closing.
flags: re.DOTALL|re.I flags: re.DOTALL|re.I
patterns: patterns:
- <(img|input|area|base|br|col[^(?:group)]|embed|hr|link|meta|param|source|track|wbr|command|keygen|menuitem|path)[^>]*?[^/]> - <(img|input|area|base|br|col[^(?:group)]|embed|hr|link|meta|param|source|track|wbr|command|keygen|menuitem|path)(\b(\"[^\"]*\"|'[^']*'|{{[^}]*}}|{%[^%]*%}|{#[^#]*#}|[^'\">{}])*)(?<!/)>
- <(img|input|area|base|br|col|embed|hr|link|meta|param|source|track|wbr|command|keygen|menuitem|path)> - <(img|input|area|base|br|col|embed|hr|link|meta|param|source|track|wbr|command|keygen|menuitem|path)>
- rule: - rule:
name: D018 name: D018

View file

@ -337,6 +337,11 @@ def test_H017(runner: CliRunner, tmp_file: TextIO) -> None:
assert result.exit_code == 0 assert result.exit_code == 0
assert "H017 1:" not in result.output assert "H017 1:" not in result.output
# test template tags inside html
write_to_file(tmp_file.name, b"<image {{ > }} />")
result = runner.invoke(djlint, [tmp_file.name])
assert "H017" not in result.output
def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None: def test_DJ018(runner: CliRunner, tmp_file: TextIO) -> None:
write_to_file( write_to_file(