2
0
Эх сурвалжийг харах

Upgrade `ruff` and replace `black` with `ruff format`

John-Scott Atlakson 1 жил өмнө
parent
commit
9a2177dc19

+ 1 - 1
.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

+ 2 - 8
.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

+ 3 - 3
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:

+ 1 - 2
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