From 55a92a46206dae32419d438078745b7c86cb2dbe Mon Sep 17 00:00:00 2001
From: Dominik Hendzel <128628266+hendzeld@users.noreply.github.com>
Date: Mon, 25 Nov 2024 13:28:19 +0100
Subject: [PATCH] Fix report template, add djlint configuration (#804)
* Ignore some basic errors
From djlint output:
H005 2:0 Html tag should have lang attribute.
H016 2:0 Missing title tag in html.
H030 2:0 Consider adding a meta description.
H031 2:0 Consider adding meta keywords.
H006 48:20 Img tag should have height and width attributes.
H013 48:20 Img tag should have an alt attribute.
H025 87:112 Tag seems to be an orphan.
* Fix input tag
Removed extra `/` that caused reporting of next tag
Co-authored-by: Pierre Sassoulas
---
.pre-commit-config.yaml | 9 +++++++++
pyproject.toml | 4 ++++
src/pytest_html/resources/index.jinja2 | 7 ++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 582e6b1..9d5a803 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -76,6 +76,15 @@ repos:
language: python
additional_dependencies: [pygments, restructuredtext_lint]
+ - repo: local
+ hooks:
+ - id: djlint
+ name: djlint
+ entry: djlint
+ files: \.jinja2$
+ language: python
+ additional_dependencies: [djlint]
+
- repo: https://github.com/elidupuis/mirrors-sass-lint
rev: "5cc45653263b423398e4af2561fae362903dd45d"
hooks:
diff --git a/pyproject.toml b/pyproject.toml
index 2d49478..51f6cc4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -111,3 +111,7 @@ warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
+
+[tool.djlint]
+profile = "jinja"
+ignore = "H005,H016,H030,H031,H006,H013"
diff --git a/src/pytest_html/resources/index.jinja2 b/src/pytest_html/resources/index.jinja2
index 933fed2..587b675 100644
--- a/src/pytest_html/resources/index.jinja2
+++ b/src/pytest_html/resources/index.jinja2
@@ -31,6 +31,7 @@
No results found. Check the filters. |
+
@@ -41,14 +42,14 @@