🚨 Develop: 完全使用 ruff 替代 isort 与 black (#3151)

This commit is contained in:
Ju4tCode
2024-12-01 12:31:11 +08:00
committed by GitHub
parent 6dad4d2a74
commit 081dc8352d
83 changed files with 1815 additions and 1769 deletions

View File

@ -46,9 +46,7 @@ uvicorn = { version = ">=0.20.0,<1.0.0", extras = [
], optional = true }
[tool.poetry.group.dev.dependencies]
ruff = "^0.7.0"
isort = "^5.10.1"
black = "^24.0.0"
ruff = "^0.8.0"
nonemoji = "^0.1.2"
pre-commit = "^4.0.0"
@ -70,31 +68,19 @@ all = ["fastapi", "quart", "aiohttp", "httpx", "websockets", "uvicorn"]
addopts = "--cov=nonebot --cov-report=term-missing"
filterwarnings = ["error", "ignore::DeprecationWarning"]
[tool.black]
line-length = 88
target-version = ["py39", "py310", "py311", "py312"]
include = '\.pyi?$'
extend-exclude = '''
'''
[tool.isort]
profile = "black"
line_length = 88
length_sort = true
skip_gitignore = true
force_sort_within_sections = true
src_paths = ["nonebot", "tests"]
extra_standard_library = ["typing_extensions"]
[tool.ruff]
line-length = 88
target-version = "py39"
[tool.ruff.format]
line-ending = "lf"
[tool.ruff.lint]
select = [
"F", # Pyflakes
"W", # pycodestyle warnings
"E", # pycodestyle errors
"I", # isort
"UP", # pyupgrade
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
@ -103,6 +89,7 @@ select = [
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"TID", # flake8-tidy-imports
"RUF", # Ruff-specific rules
]
ignore = [
@ -113,10 +100,19 @@ ignore = [
"RUF003", # ambiguous-unicode-character-comment
]
[tool.ruff.lint.isort]
force-sort-within-sections = true
known-first-party = ["nonebot", "tests/*"]
extra-standard-library = ["typing_extensions"]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true
[tool.pyright]
pythonVersion = "3.9"
pythonPlatform = "All"