From aefcbee8e89bd52fdb2186290e223e767d3c53e6 Mon Sep 17 00:00:00 2001 From: 100gle Date: Fri, 9 Jun 2023 12:56:05 +0800 Subject: [PATCH] ci: integrate black and pre-commit for formatting codes --- backend/.pre-commit-config.yaml | 6 ++++++ backend/pyproject.toml | 4 ++++ backend/requirements-dev.txt | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 backend/.pre-commit-config.yaml diff --git a/backend/.pre-commit-config.yaml b/backend/.pre-commit-config.yaml new file mode 100644 index 00000000..5f02f32e --- /dev/null +++ b/backend/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + language: python diff --git a/backend/pyproject.toml b/backend/pyproject.toml index ca9b44c4..b70f6a71 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -57,3 +57,7 @@ target-version = "py310" [tool.ruff.mccabe] # Unlike Flake8, default to a complexity level of 10. max-complexity = 10 + +[tool.black] +line-length = 88 +target-version = ['py310', 'py311'] diff --git a/backend/requirements-dev.txt b/backend/requirements-dev.txt index 40cd4be6..8240495a 100644 --- a/backend/requirements-dev.txt +++ b/backend/requirements-dev.txt @@ -1,2 +1,4 @@ -r requirements.txt -ruff \ No newline at end of file +ruff +black +pre-commit \ No newline at end of file