-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
75 lines (67 loc) · 2.1 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
75 lines (67 loc) · 2.1 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
# Pre-commit hooks for AdCP Python client
# See https://pre-commit.com for more information
# Installation: pip install pre-commit && pre-commit install
repos:
# Black code formatting
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.10
args: [--line-length=100]
# Ruff linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: ^src/adcp/types/generated\.py$
# Mypy type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.0
hooks:
- id: mypy
additional_dependencies:
- pydantic>=2.0.0
- types-requests
args: [--config-file=pyproject.toml]
files: ^src/adcp/
exclude: ^src/adcp/types/generated\.py$
# 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]
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
# Validate generated code after schema changes
- repo: local
hooks:
- id: validate-generated-code
name: Validate generated Pydantic models
entry: python -m py_compile
language: system
files: ^src/adcp/types/generated\.py$
pass_filenames: true
description: Ensures generated code is syntactically valid Python
- id: test-code-generation
name: Test code generator
entry: pytest tests/test_code_generation.py -v --tb=short
language: system
files: ^scripts/generate_models_simple\.py$
pass_filenames: false
description: Run code generation tests when generator changes
# Configuration
default_language_version:
python: python3.10
# Run hooks on all files during manual runs
fail_fast: false