mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-05 20:34:42 +00:00
updated regex for H021. Added test. closes #72
This commit is contained in:
parent
9addd5dc04
commit
adbef74d38
2 changed files with 10 additions and 2 deletions
|
|
@ -280,7 +280,7 @@
|
|||
message: Inline styles should be avoided.
|
||||
flags: re.I
|
||||
patterns:
|
||||
- <\w+\s[^>]*style(?=[^>]*>)
|
||||
- <\w+\s(?:[^>]*\s)?style(?=[^>]*>)
|
||||
- rule:
|
||||
name: H022
|
||||
message: Use HTTPS for external links.
|
||||
|
|
|
|||
|
|
@ -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_H021 --cov=src/djlint --cov-branch \
|
||||
--cov-report xml:coverage.xml --cov-report term-missing
|
||||
|
||||
"""
|
||||
|
|
@ -285,6 +285,14 @@ def test_H021(runner: CliRunner, tmp_file: TextIO) -> None:
|
|||
assert result.exit_code == 1
|
||||
assert "H021 1:" in result.output
|
||||
|
||||
write_to_file(
|
||||
tmp_file.name,
|
||||
b'<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet" />',
|
||||
)
|
||||
result = runner.invoke(djlint, [tmp_file.name])
|
||||
assert result.exit_code == 0
|
||||
assert "H021" not in result.output
|
||||
|
||||
|
||||
def test_H022(runner: CliRunner, tmp_file: TextIO) -> None:
|
||||
write_to_file(tmp_file.name, b'<a href="http://">')
|
||||
|
|
|
|||
Loading…
Reference in a new issue