diff --git a/src/djlint/rules.yaml b/src/djlint/rules.yaml
index adbd92e..d10dc88 100644
--- a/src/djlint/rules.yaml
+++ b/src/djlint/rules.yaml
@@ -160,7 +160,7 @@
message: Inline styles should be avoided.
flags: re.I
patterns:
- - <\w+\s(?:[^>]*\s)?style(?=[^>]*>)
+ - <\w+\s(?:[^>]*\s)?style=(?=[^>]*>)
- rule:
name: H022
message: Use HTTPS for external links.
diff --git a/tests/test_linter.py b/tests/test_linter.py
index db5459e..58dc3ed 100644
--- a/tests/test_linter.py
+++ b/tests/test_linter.py
@@ -7,7 +7,7 @@ run::
# for a single test
- pytest tests/test_linter.py::test_T028 --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
"""
@@ -341,6 +341,14 @@ def test_H021(runner: CliRunner, tmp_file: TextIO) -> None:
assert result.exit_code == 0
assert "H021" not in result.output
+ write_to_file(
+ tmp_file.name,
+ b'CSS',
+ )
+ 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'')