forked from a2aproject/a2a-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
82 lines (73 loc) · 2.55 KB
/
.pre-commit-config.yaml
File metadata and controls
82 lines (73 loc) · 2.55 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
---
repos:
# ===============================================
# Pre-commit standard hooks (general file cleanup)
# ===============================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace # Removes extra whitespace at the end of lines
- id: end-of-file-fixer # Ensures files end with a newline
- id: check-yaml # Checks YAML file syntax (before formatting)
- id: check-toml # Checks TOML file syntax (before formatting)
- id: check-added-large-files # Prevents committing large files
args: [--maxkb=500] # Example: Limit to 500KB
- id: check-merge-conflict # Checks for merge conflict strings
- id: detect-private-key # Detects accidental private key commits
# Formatter and linter for TOML files
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
- id: taplo-lint
# YAML files
- repo: https://github.com/lyz-code/yamlfix
rev: 1.17.0
hooks:
- id: yamlfix
# ===============================================
# Python Hooks
# ===============================================
# no_implicit_optional for ensuring explicit Optional types
- repo: https://github.com/hauntsaninja/no_implicit_optional
rev: '1.4'
hooks:
- id: no_implicit_optional
args: [--use-union-or]
# Pyupgrade for upgrading Python syntax to newer versions
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py310-plus] # Target Python 3.10+ syntax, matching project's target
# Autoflake for removing unused imports and variables
- repo: https://github.com/pycqa/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place, --remove-all-unused-imports]
# Ruff for linting and formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0
hooks:
- id: ruff
args: [--fix, --exit-zero] # Apply fixes, and exit with 0 even if files were modified
exclude: ^src/a2a/grpc/
- id: ruff-format
exclude: ^src/a2a/grpc/
# Keep uv.lock in sync
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.13
hooks:
- id: uv-lock
# Commitzen for conventional commit messages
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.8.3
hooks:
- id: commitizen
stages: [commit-msg]
# Gitleaks
- repo: https://github.com/gitleaks/gitleaks
rev: v8.27.2
hooks:
- id: gitleaks