From 0a8a5c11aab719db7bbad02b876155245fac00ee Mon Sep 17 00:00:00 2001 From: Azide Date: Sat, 15 Jul 2023 23:05:38 +0800 Subject: [PATCH] =?UTF-8?q?:wrench:=20=E6=B7=BB=E5=8A=A0ruff=E5=92=8Cnonem?= =?UTF-8?q?oji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 40 +++++++++++++++++++++++++++++-------- poetry.lock | 44 ++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 26 ++++++++++++++++++++---- 3 files changed, 97 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 83d170b..bc1b46b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,37 @@ +default_install_hook_types: [pre-commit, prepare-commit-msg] ci: autofix_commit_msg: ":lipstick: auto fix by pre-commit hooks" autofix_prs: true - autoupdate_branch: dev - autoupdate_schedule: weekly + autoupdate_branch: main + autoupdate_schedule: monthly autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.276 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + stages: [commit] + - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: - id: isort + stages: [commit] - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.7.0 hooks: - id: black + stages: [commit] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v3.0.0-alpha.9-for-vscode hooks: - id: prettier - types_or: [markdown, ts, tsx] - exclude: 'admin-frontend/' + types_or: [javascript, jsx, ts, tsx, markdown, yaml, json] + exclude: "admin-frontend/" + stages: [commit] - repo: https://github.com/pre-commit/mirrors-eslint rev: v8.33.0 @@ -41,6 +52,19 @@ repos: types_or: [ts, tsx] types: [] files: ^admin-frontend/ - args: [--fix, -c, './admin-frontend/.eslintrc.json', --rule, 'import/no-unresolved: off'] + args: + [ + --fix, + -c, + "./admin-frontend/.eslintrc.json", + --rule, + "import/no-unresolved: off", + ] -exclude: 'CHANGELOG.md' + - repo: https://github.com/nonebot/nonemoji + rev: v0.1.4 + hooks: + - id: nonemoji + stages: [prepare-commit-msg] + +exclude: "CHANGELOG.md" diff --git a/poetry.lock b/poetry.lock index 0a13fe0..13f6825 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1618,6 +1618,21 @@ nonebot-plugin-send-anything-anywhere = ">=0.2.4,<0.3.0" nonebug = ">=0.3.1,<0.4.0" pytest-mock = ">=3.10.0,<4.0.0" +[[package]] +name = "nonemoji" +version = "0.1.4" +description = "Simple gitmoji cli written in python" +category = "dev" +optional = false +python-versions = ">=3.7.3,<4.0.0" +files = [ + {file = "nonemoji-0.1.4-py3-none-any.whl", hash = "sha256:6e2b22d315bd936df7d004cf55b13fac5d55abd36aba6b37b405da39b6f78269"}, + {file = "nonemoji-0.1.4.tar.gz", hash = "sha256:f7480e1f2f27f0a149da23f371bab0a47dd2cf46674f61798658b3daa7836fc5"}, +] + +[package.dependencies] +noneprompt = ">=0.1.3,<0.2.0" + [[package]] name = "noneprompt" version = "0.1.9" @@ -2362,6 +2377,33 @@ files = [ [package.dependencies] httpx = ">=0.21.0" +[[package]] +name = "ruff" +version = "0.0.278" +description = "An extremely fast Python linter, written in Rust." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.0.278-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:1a90ebd8f2a554db1ee8d12b2f3aa575acbd310a02cd1a9295b3511a4874cf98"}, + {file = "ruff-0.0.278-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:38ca1c0c8c1221fe64c0a66784c91501d09a8ed02a4dbfdc117c0ce32a81eefc"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c62a0bde4d20d087cabce2fa8b012d74c2e985da86d00fb3359880469b90e31"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7545bb037823cd63dca19280f75a523a68bd3e78e003de74609320d6822b5a52"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8cb380d2d6fdb60656a0b5fa78305535db513fc72ce11f4532cc1641204ef380"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:d11149c7b186f224f2055e437a030cd83b164a43cc0211314c33ad1553ed9c4c"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:666e739fb2685277b879d493848afe6933e3be30d40f41fe0e571ad479d57d77"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ec8b0469b54315803aaf1fbf9a37162a3849424cab6182496f972ad56e0ea702"}, + {file = "ruff-0.0.278-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c25b96602695a147d62a572865b753ef56aff1524abab13b9436724df30f9bd7"}, + {file = "ruff-0.0.278-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a48621f5f372d5019662db5b3dbfc5f1450f927683d75f1153fe0ebf20eb9698"}, + {file = "ruff-0.0.278-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1078125123a3c68e92463afacedb7e41b15ccafc09e510c6c755a23087afc8de"}, + {file = "ruff-0.0.278-py3-none-musllinux_1_2_i686.whl", hash = "sha256:3ce0d620e257b4cad16e2f0c103b2f43a07981668a3763380542e8a131d11537"}, + {file = "ruff-0.0.278-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1cae4c07d334eb588f171f1363fa89a8911047eb93184276be11a24dbbc996c7"}, + {file = "ruff-0.0.278-py3-none-win32.whl", hash = "sha256:70d39f5599d8449082ab8ce542fa98e16413145eb411dd1dc16575b44565d52d"}, + {file = "ruff-0.0.278-py3-none-win_amd64.whl", hash = "sha256:e131595ab7f4ce61a1650463bd2fe304b49e7d0deb0dfa664b92817c97cdba5f"}, + {file = "ruff-0.0.278-py3-none-win_arm64.whl", hash = "sha256:737a0cfb6c36aaa92d97a46957dfd5e55329299074ad06ed12663b98e0c6fc82"}, + {file = "ruff-0.0.278.tar.gz", hash = "sha256:1a9f1d925204cfba81b18368b7ac943befcfccc3a41e170c91353b674c6b7a66"}, +] + [[package]] name = "setuptools" version = "68.0.0" @@ -3018,4 +3060,4 @@ yaml = [] [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0.0" -content-hash = "0ae3754ddb7ccdb0417c1c3a68d8b6d4d85371c897f754b7ad2569d54fcb136e" +content-hash = "ebdfa08b980a1aa80d983b4a7b7e8293934a09e446f55fe83b8b90b2e866e0c4" diff --git a/pyproject.toml b/pyproject.toml index 1458dd3..a3d5789 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,8 @@ nonebug = { git = "https://github.com/nonebot/nonebug.git", rev = "master" } pytest-xdist = { extras = ["psutil"], version = "^3.1.0" } nb-cli = "^1.0.5" nonebug-saa = "^0.2.1" +ruff = "^0.0.278" +nonemoji = "^0.1.4" [tool.poetry.extras] cli = ["anyio", "click", "typing-extensions"] @@ -62,7 +64,7 @@ all = ["anyio", "click", "typing-extensions", "pyyaml"] bison = "nonebot_bison.script.cli:main" [build-system] -requires = ["poetry>=0.12"] +requires = ["poetry>=1.0.0"] build-backend = "poetry.masonry.api" [tool.pytest.ini_options] @@ -73,21 +75,37 @@ markers = [ ] asyncio_mode = "auto" +[tool.ruff] +select = ["E", "W", "F", "UP", "C", "T", "PYI", "PT", "Q"] +ignore = ["E402", "C901"] + +line-length = 120 +target-version = "py310" + [tool.black] -line-length = 88 -target-version = ["py310"] +line-length = 120 +target-version = ["py310", "py311"] include = '\.pyi?$' extend-exclude = ''' ''' [tool.isort] profile = "black" -line_length = 88 +line_length = 120 skip_gitignore = true +length_sort = true +force_sort_within_sections = true +src_paths = ["nonebot_bison", "tests"] +extra_standard_library = ["typing_extensions"] [tool.nonebot] plugins = ["nonebot_bison"] [tool.pyright] +reportShadowedImports = false pythonVersion = "3.10" pythonPlatform = "All" +executionEnvironments = [ + { root = "./tests", extraPaths = ["./"] }, + { root = "./" }, +]