mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-26 13:23:59 +00:00
updated regex on H024. Added test. closes #78
This commit is contained in:
parent
242b67898e
commit
34fb305b6b
2 changed files with 13 additions and 3 deletions
|
|
@ -298,7 +298,7 @@
|
|||
message: Omit type on scripts and styles.
|
||||
flags: re.I
|
||||
patterns:
|
||||
- <(?:script|style)[^>]*?type=["|'][^>]*?>
|
||||
- <(?:script|style)[^>]*?type=[\"|'](?:(?:text/css)|(?:text/javascript))[^>]*?>
|
||||
- rule:
|
||||
name: H025
|
||||
message: Tag seems to be an orphan.
|
||||
|
|
|
|||
|
|
@ -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_H024 --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
"""
|
||||
|
|
@ -312,7 +312,17 @@ def test_H024(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
write_to_file(tmp_file.name, b'<script type="hare">')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H024 1:" in result.output
|
||||
assert "H024" not in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b'<script type="text/javascript">')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H024" in result.output
|
||||
|
||||
write_to_file(tmp_file.name, b'<script type="text/css">')
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 1
|
||||
assert "H024" in result.output
|
||||
|
||||
|
||||
def test_H025(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue