From 9b25a1c1093feb28edc1be46cf4478dc3c80dff6 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Fri, 2 Feb 2024 14:38:37 +0800 Subject: [PATCH] chore: replace black with ruff Signed-off-by: Jack Cherng --- Makefile | 14 +++++++++----- pyproject.toml | 29 ++++++----------------------- requirements.txt | 3 +-- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 2449cbdd..28bc3e59 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,16 @@ install: .PHONY: ci-check ci-check: + @echo "========== check: mypy ==========" mypy -p plugin - ruff check --diff --preview . - black --diff --preview --check . + @echo "========== check: ruff (lint) ==========" + ruff check --diff . + @echo "========== check: ruff (format) ==========" + ruff format --diff . .PHONY: ci-fix ci-fix: - ruff check --preview --fix . - # ruff format --preview . - black --preview . + @echo "========== fix: ruff (lint) ==========" + ruff check --fix . + @echo "========== fix: ruff (format) ==========" + ruff format . diff --git a/pyproject.toml b/pyproject.toml index 1179fd02..fe7b0f76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,24 +9,6 @@ module = ["plugin.libs.*"] ignore_errors = true ignore_missing_imports = true -[tool.black] -preview = true -line-length = 120 -target-version = ['py38'] -exclude = ''' -/( - \.git - | \.?venv - | \.mypy_cache - | br-.* - | branch-.* - | libs - | stubs - | tests/files - | typings -)/ -''' - [tool.pyright] include = ['./'] exclude = [ @@ -43,18 +25,15 @@ pythonVersion = '3.8' [tool.ruff] preview = true -select = ["E", "F", "W", "I", "UP"] -ignore = ["E203"] line-length = 120 target-version = 'py38' exclude = [ + "*/libs/*", ".git", ".mypy_cache", ".venv", ".venv-*", "branch-*", - "libs", - "plugin/libs", "stubs", "tests/files", "typings", @@ -63,5 +42,9 @@ exclude = [ "venv-*", ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint] +select = ["E", "F", "W", "I", "UP"] +ignore = ["E203"] + +[tool.ruff.lint.per-file-ignores] "boot.py" = ["E402"] diff --git a/requirements.txt b/requirements.txt index 350988bb..8a2e12d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ # This is an implicit value, here for clarity --index https://pypi.python.org/simple/ -black mypy -ruff +ruff>=0.2