diff --git a/src/djlint/helpers.py b/src/djlint/helpers.py index 014f7a6..0bc82a2 100644 --- a/src/djlint/helpers.py +++ b/src/djlint/helpers.py @@ -148,8 +148,14 @@ def inside_ignored_rule(config: Config, html: str, match: re.Match, rule: str) - ): if ( rule in list(set(re.split(r"\s|,", ignored_match.group(1).strip()))) - and ignored_match.start(0) <= match.start() - and match.end(0) <= ignored_match.end() + and ( + ignored_match.start(0) <= match.start() + and match.start() <= ignored_match.end() + ) + or ( + ignored_match.start(0) <= match.end() + and match.end() <= ignored_match.end() + ) ): return True return False diff --git a/tests/test_linter/test_linter.py b/tests/test_linter/test_linter.py index 92579d5..9e53cb3 100644 --- a/tests/test_linter/test_linter.py +++ b/tests/test_linter/test_linter.py @@ -7,7 +7,7 @@ run:: # for a single test - pytest tests/test_linter/test_linter.py::test_T001 + pytest tests/test_linter/test_linter.py::test_ignoring_rules """ # pylint: disable=C0116,C0103 @@ -897,3 +897,20 @@ def test_ignoring_rules(runner: CliRunner, tmp_file: TextIO) -> None: ) result = runner.invoke(djlint, [tmp_file.name]) assert "H025" not in result.output + + # using tabs + write_to_file( + tmp_file.name, + b"""
+
+\t\t{# djlint:on #}
+
+