chore: 配置 pre-commit 钩子(ruff + mypy + 通用检查)

This commit is contained in:
2026-07-11 20:08:21 +08:00
parent 4710a305be
commit 7e0b9553c8
2 changed files with 36 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-toml
- id: check-added-large-files
args: ['--maxkb=500']
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
args: [--ignore-missing-imports, --no-strict-optional]
files: ^src/
additional_dependencies:
- types-pyyaml
- types-requests
+5
View File
@@ -41,6 +41,11 @@ index-strategy = "unsafe-best-match"
line-length = 100 line-length = 100
target-version = "py313" target-version = "py313"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
[tool.ruff.lint] [tool.ruff.lint]
select = ["E", "F", "I", "N", "W"] select = ["E", "F", "I", "N", "W"]