Skip to content

Commit 6b2de87

Browse files
committed
CU-86b7kybxx - feat: update README and pre-commit hook to support custom commands for linting and type checking
1 parent a484b30 commit 6b2de87

2 files changed

Lines changed: 46 additions & 246 deletions

File tree

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ Git hooks for development workflow automation.
55
## Features
66

77
- **commit-msg**: Validates commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format (with optional ClickUp ID)
8-
- **pre-commit**: Runs PHPCS code quality checks for Drupal and WordPress projects
9-
- **pre-push**: Validates branch naming + runs custom commands from config file
8+
- **pre-commit**: Runs custom commands (lint, type check, format) from config file
9+
- **pre-push**: Validates branch naming + runs custom commands (tests) from config file
1010

1111
## Installation
1212

1313
```bash
14-
pip install dev-tools-hooks
14+
pip install git+https://github.com/swapps/dev-tools-hooks.git
1515
```
1616

1717
Or install from source:
@@ -75,10 +75,10 @@ Examples:
7575

7676
### pre-commit
7777

78-
For PHP projects (Drupal/WordPress), automatically:
79-
- Detects project type from `config.yml`
80-
- Installs PHPCS and coding standards if needed
81-
- Validates staged PHP files against coding standards
78+
Runs custom commands defined in `.dev-hooks.yml` before each commit:
79+
- Lint checks
80+
- Type checking
81+
- Format validation
8282

8383
### pre-push
8484

@@ -87,11 +87,11 @@ For PHP projects (Drupal/WordPress), automatically:
8787
- Conventional: `<type>/<description>` (e.g., `feat/user-login`, `fix/header-bug`)
8888
- Special branches: `master`, `main`, `develop`, `staging`, `production`
8989

90-
2. **Custom commands** - Runs commands defined in `.dev-hooks.yml` before pushing
90+
2. **Custom commands** - Runs commands defined in `.dev-hooks.yml` (tests, build, etc.)
9191

9292
## Configuration File
9393

94-
Create a `.dev-hooks.yml` file in your project root to configure custom pre-push commands.
94+
Create a `.dev-hooks.yml` file in your project root to configure custom commands.
9595

9696
Copy the example file to get started:
9797

@@ -102,21 +102,23 @@ cp .dev-hooks.example.yml .dev-hooks.yml
102102
### Example Configuration
103103

104104
```yaml
105-
# Pre-push commands
106-
pre-push:
105+
# Pre-commit commands (run on every commit)
106+
pre-commit:
107107
enabled: true
108-
skip_branch_validation: false
109-
110108
commands:
111-
- name: "Run Tests"
112-
run: "pytest"
113-
114109
- name: "Lint Check"
115110
run: "ruff check src/"
116-
117111
- name: "Type Check"
118112
run: "mypy src/"
119113

114+
# Pre-push commands (run before push)
115+
pre-push:
116+
enabled: true
117+
skip_branch_validation: false
118+
commands:
119+
- name: "Run Tests"
120+
run: "pytest"
121+
120122
# Docker support (optional)
121123
docker:
122124
enabled: false
@@ -133,17 +135,22 @@ For dockerized projects, enable docker execution:
133135
docker:
134136
enabled: true
135137
compose: true
136-
container: "php"
138+
container: "app"
139+
140+
pre-commit:
141+
commands:
142+
- name: "Lint"
143+
run: "npm run lint"
137144

138145
pre-push:
139146
commands:
140-
- name: "PHPUnit"
141-
run: "vendor/bin/phpunit"
147+
- name: "Tests"
148+
run: "npm test"
142149
```
143150
144151
Commands will be executed inside the container:
145152
```bash
146-
docker-compose exec -T php vendor/bin/phpunit
153+
docker-compose exec -T app npm run lint
147154
```
148155

149156
## Development
@@ -162,4 +169,4 @@ dev-hooks --help
162169

163170
## License
164171

165-
MIT
172+
MIT - Copyright (c) 2025 Swapps

0 commit comments

Comments
 (0)