mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-04 11:54:44 +00:00
Merge pull request #157 from jayvdb/H023-fix
Specify acceptable entities
This commit is contained in:
commit
14599f6936
2 changed files with 38 additions and 1 deletions
|
|
@ -172,7 +172,7 @@
|
|||
message: Do not use entity references.
|
||||
flags: re.I
|
||||
patterns:
|
||||
- '&.{5};'
|
||||
- '&(?!(lt|gt|amp|quot|nbsp|ensp|emsp|thinsp))[#0-9a-z]{,30};'
|
||||
- rule:
|
||||
name: H024
|
||||
message: Omit type on scripts and styles.
|
||||
|
|
|
|||
|
|
@ -343,6 +343,43 @@ def test_H023(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b"á")
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b">")
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
|
||||
write_to_file(tmp_file.name, b'<a href=" > "></a>')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
|
||||
write_to_file(tmp_file.name, b'<a href=" foo & bar; "></a>')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
|
||||
write_to_file(tmp_file.name, b'<a href=" á "></a>')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b"?")
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b"?")
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b'<a href=" ? "></a>')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H023 1:" in result.output
|
||||
|
||||
|
||||
def test_H024(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b'<script type="hare">')
|
||||
|
|
|
|||
Loading…
Reference in a new issue