0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-21 18:09:02 +01:00

Added lint-server, lint-client, format-server and format-client tasks to the Makefile (#8177)

This commit is contained in:
Hitansh Shah 2022-03-21 12:55:36 +05:30 committed by Matt Westcott
parent e961ae202c
commit a8106e5072
6 changed files with 21 additions and 5 deletions

View File

@ -33,6 +33,7 @@ Changelog
* Replace `content_json` `TextField` with `content` `JSONField` in `PageRevision` (Sage Abdullah)
* Remove `replace_text` management command (Sage Abdullah)
* Replace `data_json` `TextField` with `data` `JSONField` in `BaseLogEntry` (Sage Abdullah)
* Split up linting / formatting tasks in Makefile into client and server components (Hitansh Shah)
* Fix: When using `simple_translations` ensure that the user is redirected to the page edit view when submitting for a single locale (Mitchel Cabuloy)
* Fix: When previewing unsaved changes to `Form` pages, ensure that all added fields are correctly shown in the preview (Joshua Munn)
* Fix: When Documents (e.g. PDFs) have been configured to be served inline via `WAGTAILDOCS_CONTENT_TYPES` & `WAGTAILDOCS_INLINE_CONTENT_TYPES` ensure that the filename is correctly set in the `Content-Disposition` header so that saving the files will use the correct filename (John-Scott Atlakson)

View File

@ -576,6 +576,7 @@ Contributors
* Kyle Hart
* Stephanie Cheng Smith
* Luis Espinoza
* Hitansh Shah
Translators
===========

View File

@ -4,6 +4,7 @@ help:
@echo "clean-pyc - remove Python file artifacts"
@echo "develop - install development dependencies"
@echo "lint - check style with black, flake8, sort python with isort, indent html, and lint frontend css/js"
@echo "format - enforce a consistent code style across the codebase, sort python files with isort and fix frontend css/js"
@echo "test - run tests"
@echo "coverage - check code coverage"
@ -16,24 +17,34 @@ develop: clean-pyc
pip install -e .[testing,docs]
npm install --no-save && npm run build
lint:
lint-server:
black --target-version py37 --check --diff .
flake8
isort --check-only --diff .
curlylint --parse-only wagtail
git ls-files '*.html' | xargs djhtml --check
lint-client:
npm run lint:css --silent
npm run lint:js --silent
npm run lint:format --silent
lint-docs:
doc8 docs
format:
lint: lint-server lint-client lint-docs
format-server:
black --target-version py37 .
isort .
git ls-files '*.html' | xargs djhtml -i
format-client:
npm run format
npm run fix:js
format: format-server format-client
test:
python runtests.py

View File

@ -7,7 +7,8 @@ Linting HTML
~~~~~~~~~~~~
We use `curlylint <https://www.curlylint.org/>`_ 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``.
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``. Alternatively you can also run
``make lint-client`` for checking and ``make format-client`` for formatting frontend (html/css/js) only files.
Principles
~~~~~~~~~~

View File

@ -14,9 +14,10 @@ run by ``pre-commit`` if that is configured.
In addition, import lines should be sorted according to `isort <https://pycqa.github.io/isort/>`_ 5.6.4 rules.
If you have installed Wagtail's testing dependencies (``pip install -e '.[testing]'``), you can check your code by
running ``make lint``.
running ``make lint``. You can also just check python related linting by running ``make lint-server``.
You can run all Python formatting with ``make format``.
You can run all Python formatting with ``make format``. Similar to linting you can format python/template only files
by running ``make format-server``.
Django compatibility
~~~~~~~~~~~~~~~~~~~~

View File

@ -55,6 +55,7 @@ The panel types `StreamFieldPanel`, `RichTextFieldPanel`, `ImageChooserPanel`, `
* Add Pinterest support to the list of default oEmbed providers (Dharmik Gangani)
* Update Jinja2 template support for Jinja2 3.x (Seb Brown)
* Add ability for `StreamField` to use `JSONField` to store data, rather than `TextField` (Sage Abdullah)
* Split up linting / formatting tasks in Makefile into client and server components (Hitansh Shah)
### Bug fixes