Skip to content

Commit bccc364

Browse files
authored
fix(src): resolve exclude paths (#1034)
1 parent cd26c1f commit bccc364

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

djlint/settings.py

+4
Original file line numberDiff line numberDiff line change
@@ -1123,3 +1123,7 @@ def __init__(
11231123
)
11241124
"""
11251125
)
1126+
1127+
def get_exclude_paths(self) -> Iterator[Path]:
1128+
for p in self.exclude.split("|"):
1129+
yield Path(p.strip().replace("\\.", ".")).resolve()

djlint/src.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_src(src: Iterable[Path], config: Config) -> list[Path]:
4444
paths.extend(
4545
x
4646
for x in normalized_item.glob(f"**/*.{extension}")
47-
if not re.search(config.exclude, x.as_posix(), flags=re.X)
47+
if not any(x.is_relative_to(p) for p in config.get_exclude_paths())
4848
and no_pragma(config, x)
4949
and (
5050
(config.use_gitignore and not config.gitignore.match_file(x))
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[tool.djlint]
2-
exclude = "foo/excluded.html"
3-
extend_exclude = "excluded.html"
2+
exclude = "tests/test_config/test_excludes/foo/excluded.html"
3+
extend_exclude = "tests/test_config/test_excludes/excluded.html"

0 commit comments

Comments
 (0)