Skip to content

Commit a484b30

Browse files
committed
CU-86b7kybxx - feat: enhance pre-commit and pre-push hooks with detailed commands and checks
1 parent 1c041b7 commit a484b30

File tree

3 files changed

+405
-174
lines changed

3 files changed

+405
-174
lines changed

.dev-hooks.example.yml

Lines changed: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Dev Tools Hooks Configuration
22
# Copy this file to .dev-hooks.yml in your project root
33

4+
# Pre-commit commands
5+
# These commands run before each commit
6+
# If any command fails, the commit is aborted
7+
pre-commit:
8+
# Enable/disable pre-commit checks (default: true)
9+
enabled: true
10+
11+
# Commands to run before commit
12+
commands:
13+
# Example: Run linter
14+
- name: "Lint Check"
15+
run: "ruff check src/"
16+
17+
# Example: Type checking
18+
- name: "Type Check"
19+
run: "mypy src/"
20+
21+
# Example: Format check
22+
- name: "Format Check"
23+
run: "ruff format --check src/"
24+
425
# Pre-push commands
526
# These commands run before pushing to remote
627
# If any command fails, the push is aborted
@@ -12,23 +33,10 @@ pre-push:
1233
skip_branch_validation: false
1334

1435
# Commands to run before push
15-
# Each command runs in sequence, push is aborted if any fails
1636
commands:
1737
# Example: Run tests
1838
- name: "Run Tests"
1939
run: "pytest"
20-
# Optional: only run for specific branches (regex)
21-
# branches: "^(feat|fix)/.*"
22-
23-
# Example: Run linter
24-
- name: "Lint Check"
25-
run: "ruff check src/"
26-
27-
# Example: Type checking
28-
- name: "Type Check"
29-
run: "mypy src/"
30-
# Optional: allow this command to fail without blocking push
31-
allow_failure: false
3240

3341
# Docker support
3442
# If your project runs in Docker, configure it here
@@ -45,14 +53,62 @@ docker:
4553
# docker-compose file path (default: docker-compose.yml)
4654
compose_file: "docker-compose.yml"
4755

48-
# Examples for different project types:
56+
# ============================================================================
57+
# Examples for different project types
58+
# ============================================================================
4959

5060
# --- Python Project ---
61+
# pre-commit:
62+
# commands:
63+
# - name: "Lint"
64+
# run: "ruff check ."
65+
# - name: "Types"
66+
# run: "mypy src/"
67+
# - name: "Format"
68+
# run: "ruff format --check ."
5169
# pre-push:
5270
# commands:
5371
# - name: "Tests"
5472
# run: "pytest -v"
73+
74+
# --- Node.js Project ---
75+
# pre-commit:
76+
# commands:
5577
# - name: "Lint"
56-
# run: "ruff check ."
78+
# run: "npm run lint"
5779
# - name: "Types"
58-
# run: "mypy src/"
80+
# run: "npm run typecheck"
81+
# pre-push:
82+
# commands:
83+
# - name: "Tests"
84+
# run: "npm test"
85+
# - name: "Build"
86+
# run: "npm run build"
87+
88+
# --- PHP/Drupal Project (Dockerized) ---
89+
# docker:
90+
# enabled: true
91+
# compose: true
92+
# container: "php"
93+
# pre-commit:
94+
# commands:
95+
# - name: "PHPCS"
96+
# run: "vendor/bin/phpcs --standard=Drupal web/modules/custom"
97+
# pre-push:
98+
# commands:
99+
# - name: "PHPUnit"
100+
# run: "vendor/bin/phpunit"
101+
102+
# --- Go Project ---
103+
# pre-commit:
104+
# commands:
105+
# - name: "Vet"
106+
# run: "go vet ./..."
107+
# - name: "Fmt"
108+
# run: "test -z $(gofmt -l .)"
109+
# pre-push:
110+
# commands:
111+
# - name: "Tests"
112+
# run: "go test ./..."
113+
# - name: "Build"
114+
# run: "go build ./..."

.dev-hooks.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
# Dev Tools Hooks Configuration for this project, test this repo
1+
# Dev Tools Hooks Configuration for this project
2+
3+
pre-commit:
4+
enabled: true
5+
commands:
6+
- name: "Lint Check"
7+
run: "venv/bin/ruff check src/ || true"
8+
9+
- name: "Type Check"
10+
run: "venv/bin/python -m py_compile src/dev_tools_hooks/*.py"
211

312
pre-push:
413
enabled: true
514
skip_branch_validation: false
615

716
commands:
8-
- name: "Check CLI Help"
9-
run: "venv/bin/dev-hooks --help > /dev/null"
10-
11-
- name: "Check CLI Version"
17+
- name: "Check CLI"
1218
run: "venv/bin/dev-hooks --version"

0 commit comments

Comments
 (0)