-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
89 lines (82 loc) · 2.79 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
89 lines (82 loc) · 2.79 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
# Pre-commit hooks for AdCP Python client
# See https://pre-commit.com for more information
# Installation: make bootstrap
repos:
# Black code formatting
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.11
args: [--line-length=100]
exclude: ^src/adcp/types/generated_poc/
# Ruff linting (ignoring line-length for now - black handles it)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --ignore=E501]
exclude: ^src/adcp/types/generated_poc/
# Mypy type checking (local hook to use project dependencies)
- repo: local
hooks:
- id: mypy
name: mypy
entry: uv run --extra dev mypy # --extra dev ensures types-protobuf stubs are present
language: system
types: [python]
pass_filenames: false
args: [src/adcp]
- id: adopter-type-checks
name: adopter type-check fixtures
entry: uv run --extra dev mypy
language: system
types: [python]
pass_filenames: false
args: [--strict, tests/type_checks/]
- id: adopter-type-ignore-contract
name: "adopter type-check fixtures contain no type: ignore suppressions"
entry: uv run python scripts/check_type_ignore_contract.py
language: system
types: [python]
pass_filenames: false
- id: check-commit-msg
name: release-please commit subject check
entry: scripts/check-commit-msg.sh
language: script
stages: [commit-msg]
# Security scanning with bandit
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
exclude: ^(tests/|scripts/)
# Basic file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ^schemas/
- id: end-of-file-fixer
exclude: ^schemas/
- id: check-yaml
- id: check-json
exclude: ^schemas/
- id: check-added-large-files
args: [--maxkb=1000]
# schemas/cache/ ships upstream-bundled, denormalized validator
# schemas (e.g. v3.1+ bundled core/*-response.json files exceed
# 6 MB). They're canonical from the protocol release tarball, not
# hand-authored — the large-file gate would block every schema
# sync. Same exclusion as the file-fixer hooks above.
exclude: ^schemas/
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
# Configuration
default_language_version:
python: python3.11
# Run hooks on all files during manual runs
fail_fast: false