diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 498d7c5056..f5e1232861 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index bfaa87fef8..6e205f2a21 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -576,6 +576,7 @@ Contributors * Kyle Hart * Stephanie Cheng Smith * Luis Espinoza +* Hitansh Shah Translators =========== diff --git a/Makefile b/Makefile index c05e017346..7e0d60a6cd 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/docs/contributing/html_guidelines.rst b/docs/contributing/html_guidelines.rst index 6f470e15af..897953473d 100644 --- a/docs/contributing/html_guidelines.rst +++ b/docs/contributing/html_guidelines.rst @@ -7,7 +7,8 @@ Linting HTML ~~~~~~~~~~~~ We use `curlylint `_ to lint templates and `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 ~~~~~~~~~~ diff --git a/docs/contributing/python_guidelines.rst b/docs/contributing/python_guidelines.rst index f188d57555..d9f78a7e94 100644 --- a/docs/contributing/python_guidelines.rst +++ b/docs/contributing/python_guidelines.rst @@ -14,9 +14,10 @@ run by ``pre-commit`` if that is configured. In addition, import lines should be sorted according to `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 ~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/releases/2.17.md b/docs/releases/2.17.md index d1625f63a6..90e8762273 100644 --- a/docs/releases/2.17.md +++ b/docs/releases/2.17.md @@ -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