cbd4068776
- Rename app_releases → mjk_app_releases - Rename release_packages → mjk_release_packages - Update ForeignKey reference and migration file - Add pre-commit hook: check_table_prefix.py to prevent future violations
54 lines
1.4 KiB
YAML
54 lines
1.4 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]
|
|
|
|
# 类型检查(暂时禁用:326 个历史遗留类型错误待修复)
|
|
# - 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
|
|
|
|
# 模型表名前缀一致性检查
|
|
- repo: local
|
|
hooks:
|
|
- id: table-prefix-check
|
|
name: Check model __tablename__ has mjk_ prefix
|
|
entry: python scripts/check_table_prefix.py
|
|
language: system
|
|
files: ^app/models/.*\.py$
|
|
pass_filenames: false
|