Skip to content
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] Linter doesn't raise H025 when there are matching pairs of orphan closing tags #786

Closed
3 tasks done
MrkGrgsn opened this issue Nov 9, 2023 · 2 comments · Fixed by #788
Closed
3 tasks done
Labels
🔍 linter 🦠 bug Something isn't working released

Comments

@MrkGrgsn
Copy link
Contributor

MrkGrgsn commented Nov 9, 2023

System Info

  • OS: Fedora 38
  • Python Version 3.11.6
  • djLint Version 1.34.0
  • template language: N/A

Issue

If there are matching orphaned closing HTML tags, an H025 warning isn't raised. I expect it to raise a warning for every orphan closing tag.

The rule inserts orphaned closing tags into the list of opening tags, paving the way for subsequent closing tags to match earlier closing tags and treating them as closed https://github.com/Riverside-Healthcare/djLint/blob/master/src/djlint/rules/H025.py#L49

How To Reproduce

A minimal example is this HTML source:

</p>
</p>

If you remove one of the tags, H025 is raised as expected. It happens in more complex and realistic scenarios too:

</p>
<h1>blah blah blah</h1>
<p>blah blah blah</p>
</p>

and

<h1>blah blah blah</p>
<p>blah blah blah</p>
</p>

Contents of .djlintrc/pyproject.toml [tool.djlint]

{
    "profile": "django",
    "indent": 2,
    "ignore": "T003,H021"
}
@MrkGrgsn MrkGrgsn added 🔍 linter 🦠 bug Something isn't working labels Nov 9, 2023
Copy link

welcome bot commented Nov 9, 2023

Thanks for opening your first issue here!

christopherpickering pushed a commit that referenced this issue Dec 20, 2023
## [1.34.1](v1.34.0...v1.34.1) (2023-12-20)

### Bug Fixes

* **formatter:** Avoid rewriting the file if it has not been changed ([6965ba5](6965ba5))
* **linter:** fix missed H025 for double closing ([cf52faf](cf52faf)), closes [#786](#786)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.34.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 linter 🦠 bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants