Skip to content

Commit 4e0de37

Browse files
committed
chore: add husky and commitlint for improved commit message linting
1 parent 816f0a7 commit 4e0de37

File tree

8 files changed

+925
-12
lines changed

8 files changed

+925
-12
lines changed

.github/CONTRIBUTING.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,20 @@ src/
7979

8080
### Commits
8181

82-
We follow conventional commits:
82+
We follow [Conventional Commits](https://www.conventionalcommits.org/) to automate our release process. We use `husky` and `commitlint` to enforce this standard locally.
8383

84-
- `feat:` New features
85-
- `fix:` Bug fixes
86-
- `docs:` Documentation changes
87-
- `test:` Test additions/changes
88-
- `refactor:` Code refactoring
89-
- `chore:` Maintenance tasks
84+
**Format**: `type(scope): description`
9085

91-
Example: `feat: add auto-detection of PHPStan config files`
86+
- `feat`: New features (triggers a minor version bump)
87+
- `fix`: Bug fixes (triggers a patch version bump)
88+
- `docs`: Documentation changes
89+
- `test`: Test additions/changes
90+
- `refactor`: Code refactoring
91+
- `chore`: Maintenance tasks
92+
93+
**Examples**:
94+
- `feat: add auto-detection of PHPStan config files`
95+
- `fix: resolve crash when parsing error output`
9296

9397
## Pull Request Process
9498

.github/copilot-instructions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ This project is a VS Code extension that integrates PHPStan (Static Analysis) ru
5656
- Use Status Bar items effectively to show tool status (Ready, Error, etc.).
5757
- Provide "Quick Fixes" or buttons in error messages for common actions (like "Start DDEV").
5858

59+
5. **Commit Messages**:
60+
- STRICTLY follow Conventional Commits format: `type(scope): description`.
61+
- Allowed types: `feat`, `fix`, `docs`, `test`, `refactor`, `chore`.
62+
- Examples:
63+
- `feat: add new setting`
64+
- `fix: resolve crash`
65+
5966
## Common Tasks
6067

6168
- **Adding a new setting**:

.github/workflows/commitlint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Commit Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
commitlint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 18
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Validate current commit (last commit)
18+
if: github.event_name == 'push'
19+
run: npx commitlint --from HEAD~1 --to HEAD --verbose
20+
- name: Validate PR commits
21+
if: github.event_name == 'pull_request'
22+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

0 commit comments

Comments
 (0)