-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
115 lines (107 loc) · 4 KB
/
.pre-commit-config.yaml
File metadata and controls
115 lines (107 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Global Pre-commit hooks for Augo (Mono-repo)
# Install: pip install pre-commit && pre-commit install
# Run: pre-commit run --all-files
default_language_version:
python: python3.13
repos:
# ============================================================================
# Python Hooks (Backend)
# ============================================================================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --config, server/pyproject.toml]
files: ^server/
- id: ruff-format
args: [--config, server/pyproject.toml]
files: ^server/
# Use local mypy via uv to ensure project venv and pyproject.toml config are used
- repo: local
hooks:
- id: mypy
name: mypy
entry: bash -c "cd server && uv run mypy --package app"
language: system
pass_filenames: false
files: ^server/
types: [python]
- repo: https://github.com/PyCQA/bandit
rev: 1.8.0
hooks:
- id: bandit
args: [-c, server/pyproject.toml, -r, server/app/]
additional_dependencies: ["bandit[toml]"]
files: ^server/
# ============================================================================
# Dart/Flutter Hooks (Frontend) - Using Local Commands
# ============================================================================
- repo: local
hooks:
- id: dart-format
name: Dart Format
entry: dart format
language: system
types: [dart]
files: ^client/
- id: flutter-analyze
name: Flutter Analyze
entry: bash -c "cd client && flutter analyze"
language: system
types: [dart]
files: ^client/
pass_filenames: false
# ============================================================================
# General File Checks
# ============================================================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
args: [--maxkb=1000]
- id: check-case-conflict
- id: check-merge-conflict
- id: check-yaml
args: [--unsafe]
- id: check-toml
- id: check-json
- id: end-of-file-fixer
exclude: ^(server/\.env|server/\.env\.example|client/\.env|client/\.env\.example)$
- id: trailing-whitespace
exclude: ^(server/\.env|server/\.env\.example|client/\.env|client/\.env\.example)$
# ------------------------------------------------------------------------
# 待发布 v0.1 后启用:禁止直接提交到主分支,强制执行特性分支开发流程
# ------------------------------------------------------------------------
# - id: no-commit-to-branch
# args: [--branch, main, --branch, master]
- id: detect-private-key
- id: check-ast
- id: debug-statements
# ============================================================================
# Security (Secrets)
# ============================================================================
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: [--baseline, .secrets.baseline]
exclude: |
(?x)^(
server/uv\.lock|
client/pubspec\.lock|
.*\.g\.dart| # Ignore Flutter generated code
.*\.freezed\.dart| # Ignore code gen
server/tests/.*| # Ignore python tests
client/test/.*| # Ignore flutter tests
.*\.json|
.*\.xcscheme|
client/\.metadata
)$
# ============================================================================
# Meta Checks
# ============================================================================
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
hooks:
- id: validate-pyproject
files: ^server/pyproject.toml