Skip to content

Commit f644cf7

Browse files
committed
chore: add commit guidelines and git configuration
Add Conventional Commits enforcement: - commit-msg hook validates format automatically - COMMIT_GUIDELINES.md documents standards - DEVELOPMENT.md provides best practices Consolidate author identity: - .mailmap unifies b0ony/codenimja to single identity - Set local git config to codenimja for consistency Update CONTRIBUTING.md: - Add commit message format section - Document type/scope conventions - Provide examples for contributors Addresses commit consistency going forward without rewriting history.
1 parent 552ef6b commit f644cf7

File tree

4 files changed

+181
-0
lines changed

4 files changed

+181
-0
lines changed

.github/COMMIT_GUIDELINES.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Git Hooks
2+
3+
This directory contains git hooks for maintaining code quality and consistency.
4+
5+
## commit-msg
6+
7+
Validates commit messages follow Conventional Commits format.
8+
9+
Format: `type(scope): description`
10+
11+
Allowed types:
12+
- feat: New feature
13+
- fix: Bug fix
14+
- docs: Documentation changes
15+
- chore: Maintenance tasks
16+
- refactor: Code restructuring
17+
- test: Test additions/changes
18+
- perf: Performance improvements
19+
- ci: CI/CD changes
20+
- revert: Revert previous commit
21+
- style: Code style changes
22+
- build: Build system changes
23+
24+
Examples:
25+
- `feat(channels): add MPSC support`
26+
- `fix(async): correct polling timeout`
27+
- `docs: update README performance numbers`
28+
29+
## Installation
30+
31+
Hooks are automatically active when you clone the repository. If you need to reinstall:
32+
33+
```bash
34+
chmod +x .git/hooks/commit-msg
35+
```
36+
37+
## Bypassing Hooks
38+
39+
Not recommended, but possible with:
40+
41+
```bash
42+
git commit --no-verify -m "your message"
43+
```

.github/DEVELOPMENT.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Development Guidelines
2+
3+
## Commit Best Practices
4+
5+
### Size Guidelines
6+
7+
Keep commits focused and atomic:
8+
9+
**Good commit sizes:**
10+
- Single feature or fix
11+
- Related changes only
12+
- Under 500 lines changed (guideline, not hard limit)
13+
- One logical unit of work
14+
15+
**Avoid:**
16+
- Mixing unrelated changes
17+
- Large initial dumps (split into logical commits)
18+
- Multiple features in one commit
19+
- Documentation + code changes (separate when possible)
20+
21+
### When to Split Commits
22+
23+
If your commit includes multiple of these, consider splitting:
24+
- Feature implementation
25+
- Test additions
26+
- Documentation updates
27+
- Refactoring
28+
- Bug fixes
29+
30+
### Example Split Strategy
31+
32+
Instead of:
33+
```
34+
feat: add MPSC with tests and docs (1000+ lines)
35+
```
36+
37+
Do:
38+
```
39+
feat(channels): implement MPSC core algorithm
40+
test(channels): add MPSC unit tests
41+
test(performance): add MPSC benchmark suite
42+
docs: update README for MPSC support
43+
```
44+
45+
## Revert Strategy
46+
47+
### When to Revert
48+
49+
Use `git revert` for:
50+
- Published commits (already pushed)
51+
- Tagged releases
52+
- Shared branches
53+
54+
### When to Amend/Reset
55+
56+
Use `git commit --amend` or `git reset` for:
57+
- Local commits only (not pushed)
58+
- Work-in-progress branches
59+
- Before creating PR
60+
61+
### Best Practice
62+
63+
Before pushing:
64+
```bash
65+
# Review your changes
66+
git log --oneline -5
67+
git diff origin/main
68+
69+
# Amend if needed (local only)
70+
git commit --amend
71+
72+
# Once pushed, use revert
73+
git revert <commit-hash>
74+
```
75+
76+
## Code Review Checklist
77+
78+
Before submitting PR:
79+
- [ ] Commits follow Conventional Commits format
80+
- [ ] Each commit is focused and atomic
81+
- [ ] Tests pass locally
82+
- [ ] Benchmarks run without regression
83+
- [ ] Documentation updated
84+
- [ ] No debug code or commented blocks
85+
- [ ] Author email consistent (codenimja)

.mailmap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# .mailmap - Consolidate author identities
2+
3+
# Consolidate different names/emails to single identity
4+
codenimja <byronpredicts@gmail.com> b0ony <byronpredicts@gmail.com>
5+
codenimja <byronpredicts@gmail.com> boonzy <byronpredicts@gmail.com>

docs/CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,54 @@ nimble testStress
9090
4. Include comprehensive documentation
9191
5. Update CI configuration if needed
9292

93+
## Commit Message Guidelines
94+
95+
We follow Conventional Commits format for all commit messages.
96+
97+
### Format
98+
99+
```
100+
type(scope): description
101+
102+
[optional body]
103+
104+
[optional footer]
105+
```
106+
107+
### Types
108+
109+
- `feat`: New feature
110+
- `fix`: Bug fix
111+
- `docs`: Documentation changes
112+
- `chore`: Maintenance tasks (dependencies, tooling)
113+
- `refactor`: Code restructuring without behavior change
114+
- `test`: Test additions or modifications
115+
- `perf`: Performance improvements
116+
- `ci`: CI/CD configuration changes
117+
- `revert`: Revert previous commit
118+
119+
### Examples
120+
121+
```
122+
feat(channels): add MPSC support
123+
fix(async): correct polling timeout in recv()
124+
docs: update README with verified benchmark data
125+
chore: bump Nim version to 2.2.0
126+
perf(channels): optimize ring buffer allocation
127+
```
128+
129+
### Scope
130+
131+
Optional but recommended. Indicates the module affected:
132+
- `channels`: Channel-related changes
133+
- `async`: Async/await functionality
134+
- `benchmarks`: Performance benchmarks
135+
- `tests`: Test infrastructure
136+
137+
### Enforcement
138+
139+
A commit-msg hook validates format automatically. See `.github/COMMIT_GUIDELINES.md` for details.
140+
93141
## Code Style
94142

95143
### Naming Conventions

0 commit comments

Comments
 (0)