-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.dev-hooks.example.yml
More file actions
139 lines (118 loc) · 3.71 KB
/
.dev-hooks.example.yml
File metadata and controls
139 lines (118 loc) · 3.71 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Dev Tools Hooks Configuration
# Copy this file to .dev-hooks.yml in your project root
# Pre-commit commands
# These commands run before each commit
# If any command fails, the commit is aborted
pre-commit:
# Enable/disable pre-commit checks (default: true)
enabled: true
# Only run if changes include these file patterns (optional)
# Supports multiple patterns: "*.py, *.js"
# only_for_files: "*.py"
# Django smart test detection (default: true)
# Warns if modified Python files don't have corresponding tests
# This is just a warning, it won't block the commit
django_check_tests: true
# Commands to run before commit
commands:
# Example: Run linter
- name: "Lint Check"
run: "ruff check src/"
# Example: Type checking
- name: "Type Check"
run: "mypy src/"
# Example: Format check
- name: "Format Check"
run: "ruff format --check src/"
# Pre-push commands
# These commands run before pushing to remote
# If any command fails, the push is aborted
pre-push:
# Enable/disable pre-push checks (default: true)
enabled: true
# Skip branch name validation (default: false)
skip_branch_validation: false
# Only run commands if changes include these file patterns (optional)
# If no matching files are changed, commands are skipped
# Supports multiple patterns separated by comma: "*.py, *.js"
only_for_files: "*.py"
# Django smart tests (default: true)
# When enabled, runs tests only for modified Django apps instead of all tests
# Detects which apps were modified and runs: pytest <app1> <app2> ...
django_smart_tests: true
# Test command for Django smart tests (default: "pytest")
django_test_command: "pytest"
# Commands to run before push
commands:
# Example: Run tests (only if .py files changed)
# Note: If django_smart_tests is enabled, this will be replaced with smart test execution
- name: "Run Tests"
run: "pytest"
# Docker support
# If your project runs in Docker, configure it here
docker:
# Enable docker execution (default: false)
enabled: false
# Container name or service name (for docker-compose)
container: "app"
# Use docker-compose instead of docker exec (default: false)
compose: true
# docker-compose file path (default: docker-compose.yml)
compose_file: "docker-compose.yml"
# ============================================================================
# Examples for different project types
# ============================================================================
# --- Python Project ---
# pre-commit:
# only_for_files: "*.py"
# commands:
# - name: "Lint"
# run: "ruff check ."
# - name: "Types"
# run: "mypy src/"
# pre-push:
# only_for_files: "*.py"
# commands:
# - name: "Tests"
# run: "pytest -v"
# --- Node.js Project ---
# pre-commit:
# only_for_files: "*.js, *.ts, *.tsx"
# commands:
# - name: "Lint"
# run: "npm run lint"
# - name: "Types"
# run: "npm run typecheck"
# pre-push:
# only_for_files: "*.js, *.ts, *.tsx"
# commands:
# - name: "Tests"
# run: "npm test"
# --- PHP/Drupal Project (Dockerized) ---
# docker:
# enabled: true
# compose: true
# container: "php"
# pre-commit:
# only_for_files: "*.php, *.module, *.inc"
# commands:
# - name: "PHPCS"
# run: "vendor/bin/phpcs --standard=Drupal web/modules/custom"
# pre-push:
# only_for_files: "*.php"
# commands:
# - name: "PHPUnit"
# run: "vendor/bin/phpunit"
# --- Go Project ---
# pre-commit:
# only_for_files: "*.go"
# commands:
# - name: "Vet"
# run: "go vet ./..."
# - name: "Fmt"
# run: "test -z $(gofmt -l .)"
# pre-push:
# only_for_files: "*.go"
# commands:
# - name: "Tests"
# run: "go test ./..."