Skip to content

Commit

Permalink
add make format to cover most auto-fixable formatting (wagtail#8022)
Browse files Browse the repository at this point in the history
  • Loading branch information
lb- authored Feb 24, 2022
1 parent d149a27 commit 861a509
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ lint:
npm run lint:format --silent
doc8 docs

format:
black --target-version py37 .
isort .
git ls-files '*.html' | xargs djhtml -i
npm run format
npm run fix:js

test:
python runtests.py

Expand Down
3 changes: 2 additions & 1 deletion docs/contributing/html_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ 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 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``.
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``, and format your code by running ``make format``.

Principles
~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing/python_guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ In addition, import lines should be sorted according to `isort <https://pycqa.gi
If you have installed Wagtail's testing dependencies (``pip install -e '.[testing]'``), you can check your code by
running ``make lint``.

You can run all Python formatting with ``make format``.

Django compatibility
~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 861a509

Please sign in to comment.