Skip to content

Commit 1c041b7

Browse files
committed
CU-86b7kybxx - feat: add initial configuration for git hooks and CI workflow
1 parent 176f31e commit 1c041b7

File tree

7 files changed

+154
-4
lines changed

7 files changed

+154
-4
lines changed

.dev-hooks.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Dev Tools Hooks Configuration for this project, test this repo
2+
3+
pre-push:
4+
enabled: true
5+
skip_branch_validation: false
6+
7+
commands:
8+
- name: "Check CLI Help"
9+
run: "venv/bin/dev-hooks --help > /dev/null"
10+
11+
- name: "Check CLI Version"
12+
run: "venv/bin/dev-hooks --version"

.github/workflows/test.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e .
28+
29+
- name: Test CLI
30+
run: |
31+
dev-hooks --help
32+
dev-hooks --version
33+
34+
- name: Test installation in a git repo
35+
run: |
36+
git init /tmp/test-repo
37+
dev-hooks install --path /tmp/test-repo
38+
dev-hooks list --path /tmp/test-repo
39+
dev-hooks uninstall --path /tmp/test-repo
40+
41+
lint:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: "3.11"
50+
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install ruff
55+
56+
- name: Run linter
57+
run: ruff check src/

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2024-12-10
9+
10+
### Added
11+
- Initial release
12+
- `commit-msg` hook for Conventional Commits validation
13+
- `pre-commit` hook for PHPCS code quality (Drupal/WordPress)
14+
- `pre-push` hook for branch naming conventions
15+
- CLI commands: `install`, `uninstall`, `list`
16+
- Support for selective hook installation
17+
- Force overwrite option for existing hooks

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing!
4+
5+
## Development Setup
6+
7+
1. Clone the repository:
8+
```bash
9+
git clone https://github.com/your-username/dev-tools-hooks.git
10+
cd dev-tools-hooks
11+
```
12+
13+
2. Create a virtual environment:
14+
```bash
15+
python3 -m venv venv
16+
source venv/bin/activate
17+
```
18+
19+
3. Install in development mode:
20+
```bash
21+
pip install -e .
22+
```
23+
24+
## Code Style
25+
26+
- Follow PEP 8 guidelines
27+
- Use type hints where possible
28+
- Keep functions focused and small
29+
30+
## Submitting Changes
31+
32+
1. Create a new branch: `git checkout -b feat/your-feature`
33+
2. Make your changes
34+
3. Test locally: `dev-hooks install && dev-hooks list`
35+
4. Commit using conventional commits: `feat: add new feature`
36+
5. Push and create a Pull Request
37+
38+
## Adding New Hooks
39+
40+
1. Create your hook script in `hooks/`
41+
2. Copy it to `src/dev_tools_hooks/hooks/`
42+
3. Add the hook name to `AVAILABLE_HOOKS` in `installer.py`
43+
4. Update the `cmd_list` function in `cli.py` with a description

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Swapps
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010
license = {text = "MIT"}
1111
requires-python = ">=3.8"
1212
authors = [
13-
{name = "Dev Tools", email = "dev@example.com"}
13+
{name = "Swapps", email = "dev@swapps.com"}
1414
]
1515
keywords = ["git", "hooks", "conventional-commits", "phpcs", "development"]
1616
classifiers = [
@@ -32,8 +32,8 @@ classifiers = [
3232
dev-hooks = "dev_tools_hooks.cli:main"
3333

3434
[project.urls]
35-
Homepage = "https://github.com/dev/dev-tools-hooks"
36-
Repository = "https://github.com/dev/dev-tools-hooks"
35+
Homepage = "https://github.com/swapps/dev-tools-hooks"
36+
Repository = "https://github.com/swapps/dev-tools-hooks"
3737

3838
[tool.setuptools.packages.find]
3939
where = ["src"]

src/dev_tools_hooks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"""
99

1010
__version__ = "1.0.0"
11-
__author__ = "Dev Tools"
11+
__author__ = "Swapps"
1212

1313
from .installer import install_hooks, uninstall_hooks
1414

0 commit comments

Comments
 (0)