45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
# 美家卡智影 - Git 钩子配置
|
|
# 安装: pre-commit install
|
|
# 手动运行: pre-commit run --all-files
|
|
|
|
repos:
|
|
# 代码格式化
|
|
- repo: https://github.com/psf/black
|
|
rev: 24.10.0
|
|
hooks:
|
|
- id: black
|
|
language_version: python3.13
|
|
|
|
# 代码检查
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.8.0
|
|
hooks:
|
|
- id: ruff
|
|
args: [--fix]
|
|
|
|
# TODO: 修复历史遗留类型错误后重新启用
|
|
# 类型检查(暂时禁用)
|
|
# - repo: https://github.com/pre-commit/mirrors-mypy
|
|
# rev: v1.14.0
|
|
# hooks:
|
|
# - id: mypy
|
|
# additional_dependencies: [types-PyYAML]
|
|
|
|
# 安全扫描(暂时禁用)
|
|
# - repo: https://github.com/PyCQA/bandit
|
|
# rev: 1.8.0
|
|
# hooks:
|
|
# - id: bandit
|
|
# args: ["-c", "pyproject.toml"]
|
|
# additional_dependencies: ["bandit[toml]"]
|
|
|
|
# 依赖锁定文件同步检查
|
|
- repo: local
|
|
hooks:
|
|
- id: uv-lock-check
|
|
name: Check uv lock file is up-to-date
|
|
entry: bash -c 'uv pip compile pyproject.toml -o requirements.lock --locked'
|
|
language: system
|
|
files: ^(pyproject\.toml|requirements\.lock)$
|
|
pass_filenames: false
|