-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [Linter] djlint exclude option does not work as expected #1028
Comments
I've had this issue and have managed to track it down to the default If so, this is also related to #790 |
@nemovc I just made some additional tests and I think you're right 😮 Given the following tree structure: /builds/core/api
top_level_template.html.j2
subdir1/
templates/
inner_template.html.j2 I ran the following tests (both in CI and locally): $ pwd
/builds/core/api
$ poetry run djlint --check . --exclude=build
No files to check! 😢
$ poetry run djlint --check . --exclude=builds
No files to check! 😢
$ poetry run djlint --check . --exclude=venv
Checking 2/2 files ━━━━━━━━━━ 00:00
0 files would be updated.
$ poetry run djlint --check . --exclude=templates
Checking 1/1 files ━━━━━━━━━━ 00:00
0 files would be updated.
$ poetry run djlint --check . --exclude=temp
Checking 1/1 files ━━━━━━━━━━ 00:00
0 files would be updated. I could not see the problem first since the The root cause of all of this is that none of the excluded paths is transformed to an absolute path. If I'll rename this issue and adjust the description. I think this is the root cause of: |
@monosans Could you reopen this issue after the revert? Thanks. |
System Info
3.12.7
djlint, version 1.36.1
.html.j2
extension)Issue
None of the excluded paths is transformed to an absolute path. Therefore, the check performed in https://github.com/djlint/djLint/blob/master/djlint/src.py#L47 only searches if some of the excluded patterns are contained in the current path (instead of being equal).
If
--exclude=build
is passed, all paths containing*build*
will be ignored, even if the string only partially match a parent directory (for instance,/builds/template.html.j2
,/build-my-template/template.html.j2
, etc. will always be ignored no matter wheredjlint
is ran).Expected behavior
If
--exclude=build
is passed, the final regex for excluding paths should be^{SRC}/build/.*$
How To Reproduce
See comment below: #1028 (comment)
Old reproduce steps
Tests performed on a CI runner:
Tests performed locally:
Contents of djlint.toml/.djlintrc/pyproject.toml [tool.djlint]
/cc @nejch
The text was updated successfully, but these errors were encountered: