Skip to content

Fix djlint findings in index.jinja2 so pre-commit passes - #1079

Open
contputer0x0 wants to merge 1 commit into
pytest-dev:masterfrom
contputer0x0:fix/djlint-index-template-20261013
Open

contputer0x0 wants to merge 1 commit into
pytest-dev:masterfrom
contputer0x0:fix/djlint-index-template-20261013

Conversation

@contputer0x0

Copy link
Copy Markdown

Problem

pre-commit.ci currently fails on open PRs at the djlint hook, which reports 7 findings in src/pytest_html/resources/index.jinja2. The findings are pre-existing (not introduced by any particular PR): the djlint hook is declared with additional_dependencies: [djlint] (unpinned), so as newer djlint releases tightened their rule set, the template started tripping checks that earlier cached runs on master did not. The result is that unrelated PRs get a red pre-commit.ci.

What this does

Fixes the real findings and ignores the two that are intentional:

  • H024 – drop the redundant type="text/css" on <style> and <link> (not needed in HTML5).
  • H043 – add type="button" to the Show all details / Hide all details buttons so they don't default to submit.
  • H056 / H057 – add to the existing [tool.djlint] ignore list, with a comment: the media <img>/<source> src is intentionally empty and populated at runtime by report.js, and the <video> has no caption source to track.

Verification

  • djlint src/pytest_html/resources/index.jinja2 --profile jinja with the updated ignore list: 0 errors (was 7).
  • The change is internal/tooling only; rendered reports are unaffected (removing type="text/css" and adding type="button" do not change behavior). The existing legacy_test_pytest_html.py stylesheet-link assertion checks rel="stylesheet" without type, so it still matches.

The djlint pre-commit hook (unpinned) now flags index.jinja2, which fails
pre-commit.ci on current PRs. Fix the real findings and ignore the two that
are intentional:

- H024: drop the redundant type="text/css" on <style> and <link> (HTML5).
- H043: add type="button" to the show/hide detail buttons.
- H056/H057: ignore in [tool.djlint] with a note; the media <img>/<source>
  src is populated at runtime by report.js and the <video> has no caption
  source to track.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant