Djhtml install and configure with pre-commit (#7940)

pull/7945/head
Steve Stein 2022-02-11 18:04:21 -07:00 zatwierdzone przez GitHub
rodzic 10833eddd6
commit 72886c0a62
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -24,6 +24,7 @@ jobs:
# Filter out known false positives, while preserving normal output and error codes.
# See https://github.com/motet-a/jinjalint/issues/18.
# And https://circleci.com/docs/2.0/configuration-reference/#default-shell-options.
- run: git ls-files '*.html' | xargs pipenv run djhtml --check || true
- run:
shell: /bin/bash -e
command: pipenv run jinjalint --parse-only wagtail | grep -v 'welcome_page.html:6:70' | tee /dev/tty | wc -l | grep -q '0'

Wyświetl plik

@ -38,3 +38,7 @@ repos:
additional_dependencies:
- stylelint@14.2.0
- '@wagtail/stylelint-config-wagtail@0.3.2'
- repo: https://github.com/rtts/djhtml
rev: v1.4.13
hooks:
- id: djhtml

Wyświetl plik

@ -3,7 +3,7 @@
help:
@echo "clean-pyc - remove Python file artifacts"
@echo "develop - install development dependencies"
@echo "lint - check style with flake8"
@echo "lint - check style with flake8, sort python with isort, indent html, and lint frontend css/js"
@echo "test - run tests"
@echo "coverage - check code coverage"
@ -22,6 +22,7 @@ lint:
# Filter out known false positives, while preserving normal output and error codes.
# See https://github.com/motet-a/jinjalint/issues/18.
jinjalint --parse-only wagtail | grep -v 'welcome_page.html:6:70' | tee /dev/tty | wc -l | grep -q '0'
git ls-files '*.html' | xargs djhtml --check
npm run lint:css --silent
npm run lint:js --silent
npm run lint:format --silent

Wyświetl plik

@ -6,7 +6,7 @@ We use `Django templates <https://docs.djangoproject.com/en/stable/ref/templates
Linting HTML
~~~~~~~~~~~~
We use `jinjalint <https://github.com/motet-a/jinjalint>`_ to lint templates. If you have installed Wagtail's testing dependencies (``pip install -e .[testing]``), you can check your code by running ``make lint``.
We use `jinjalint <https://github.com/motet-a/jinjalint>`_ to lint templates and `djhtml <https://github.com/rtts/djhtml>`_ to format them. If you have installed Wagtail's testing dependencies (``pip install -e .[testing]``), you can check your code by running ``make lint``.
Principles
~~~~~~~~~~

Wyświetl plik

@ -66,6 +66,9 @@ testing_extras = [
# For templates linting
'jinjalint>=0.5',
# For template indenting
'djhtml==1.4.13',
# Pipenv hack to fix broken dependency causing CircleCI failures
'docutils==0.15',