From 9a2177dc19d7ca43e3f4e6a5cdcecc6eb1a6d204 Mon Sep 17 00:00:00 2001 From: John-Scott Atlakson <24574+jsma@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:42:29 -0800 Subject: [PATCH] Upgrade `ruff` and replace `black` with `ruff format` --- .circleci/config.yml | 2 +- .pre-commit-config.yaml | 10 ++-------- Makefile | 6 +++--- setup.py | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b58d3aa666..23248e8804 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -20,7 +20,7 @@ jobs: paths: - .venv - run: pipenv run ruff check . - - run: pipenv run black --target-version py38 --check --diff . + - run: pipenv run ruff format --check . - run: pipenv run semgrep --config .semgrep.yml --error . - run: git ls-files '*.html' | xargs pipenv run djhtml --check - run: pipenv run curlylint --parse-only wagtail diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d28d32b267..64d0f4b529 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,18 +2,12 @@ default_language_version: node: system python: python3 repos: - - repo: https://github.com/psf/black - rev: 22.3.0 - hooks: - - id: black - language_version: python3 - args: ['--target-version', 'py38'] - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.290' + rev: 'v0.1.5' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-prettier rev: v3.0.3 diff --git a/Makefile b/Makefile index 549bcc7fd2..1a5905e907 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ help: @echo "clean-pyc - remove Python file artifacts" @echo "develop - install development dependencies" - @echo "lint - check style with black, ruff, sort python with ruff, indent html, and lint frontend css/js" + @echo "lint - check style with ruff, sort python with ruff, indent html, and lint frontend css/js" @echo "format - enforce a consistent code style across the codebase, sort python files with ruff and fix frontend css/js" @echo "test - run tests" @echo "coverage - check code coverage" @@ -18,7 +18,7 @@ develop: clean-pyc npm install --no-save && npm run build lint-server: - black --target-version py38 --check --diff . + ruff format --check . ruff check . curlylint --parse-only wagtail git ls-files '*.html' | xargs djhtml --check @@ -35,8 +35,8 @@ lint-docs: lint: lint-server lint-client lint-docs format-server: - black --target-version py38 . ruff check . --fix + ruff format . git ls-files '*.html' | xargs djhtml format-client: diff --git a/setup.py b/setup.py index 7b4f9a139d..dbd1cd64f9 100755 --- a/setup.py +++ b/setup.py @@ -51,9 +51,8 @@ testing_extras = [ "django-pattern-library>=0.7", # For coverage and PEP8 linting "coverage>=3.7.0", - "black==22.3.0", "doc8==0.8.1", - "ruff==0.0.290", + "ruff==0.1.5", # For enforcing string formatting mechanism in source files "semgrep==1.40.0", # For templates linting