Skip to content

Commit 4bee203

Browse files
committed
chore: standardize contributing guide across org
1 parent e00855e commit 4bee203

1 file changed

Lines changed: 82 additions & 117 deletions

File tree

CONTRIBUTING.md

Lines changed: 82 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,118 @@
1-
# Contributing to `dig`
1+
# Contributing
22

3-
Thanks for your interest in contributing. This guide covers the operational process. For the **why** — the design principles every contribution is tested against — see **[bold-minds/oss/PRINCIPLES.md](https://github.com/bold-minds/oss/blob/main/PRINCIPLES.md)**.
3+
Thank you for your interest in contributing! We welcome contributions that improve the library while maintaining its focus on simplicity, performance, and Go idioms.
44

5-
## 🎯 Before You Start
5+
## Getting Started
66

7-
Every contribution is measured against the four Bold Minds principles: **outcome naming**, **one way to do each thing**, **get out of the way**, and **non-goals explicit**. If your proposed change doesn't honor these, it will not be merged — not because the maintainers are precious, but because these principles are what make the libraries worth using.
7+
### Prerequisites
88

9-
**Read [PRINCIPLES.md](https://github.com/bold-minds/oss/blob/main/PRINCIPLES.md) first.** It's the load-bearing document.
9+
- **Go 1.22+**
10+
- **Git**
11+
- **golangci-lint** (optional, for comprehensive linting)
1012

11-
## 🔧 Development Setup
13+
### Development Setup
1214

13-
**Requirements:** Go 1.26 or later, Git, Bash.
15+
1. **Fork and clone the repository**:
16+
```bash
17+
git clone https://github.com/YOUR_USERNAME/dig.git
18+
cd dig
19+
```
1420

15-
```bash
16-
git clone https://github.com/bold-minds/dig.git
17-
cd dig
18-
go test ./... # unit tests
19-
go test -race ./... # race detection
20-
go test -bench=. ./... # benchmarks
21-
./scripts/validate.sh # full validation pipeline (local mode)
22-
./scripts/validate.sh ci # strict CI mode
23-
```
21+
2. **Run tests**:
22+
```bash
23+
go test -race ./...
24+
```
2425

25-
Your contribution must pass `./scripts/validate.sh ci` before submitting.
26+
## What We're Looking For
2627

27-
## 📁 Project Structure
28+
### Encouraged
2829

29-
```
30-
dig/
31-
├── dig.go # Implementation (single file)
32-
├── dig_test.go # Unit tests
33-
├── bench_test.go # Benchmarks
34-
├── examples/ # Runnable examples
35-
├── scripts/
36-
│ └── validate.sh # Validation pipeline
37-
├── README.md
38-
├── CONTRIBUTING.md # This file
39-
├── CHANGELOG.md
40-
├── CODE_OF_CONDUCT.md
41-
├── SECURITY.md
42-
├── LICENSE
43-
└── go.mod
44-
```
30+
- **Bug fixes** — fix issues or edge cases
31+
- **Performance improvements** — optimize without breaking compatibility
32+
- **Test enhancements** — add test cases, improve coverage
33+
- **Documentation improvements** — clarify usage, add examples
4534

46-
Keep it flat. No `internal/` directory unless the library grows significantly.
35+
### Requires Discussion First
4736

48-
## 🎨 Code Style
37+
- **API changes** — modifications to public interfaces
38+
- **New dependencies** — adding external packages
39+
- **Breaking changes** — changes that affect backward compatibility
4940

50-
### Naming
51-
- Outcome naming per PRINCIPLES.md. If you reach for a dispatcher name (`Apply`, `Mutate`, `Process`, `Handle`), stop and rename.
41+
### Not Accepted
5242

53-
### Error Handling
54-
- Base functions **must not panic**. Nil inputs, out-of-range indices, and type mismatches return zero values or fallbacks.
55-
- `Or` variants take a fallback argument and return it on failure.
56-
- **No `Must*` variants.**
43+
- **Feature creep** — complex features that don't align with Go idioms
44+
- **Non-idiomatic Go** — code that doesn't follow Go conventions
45+
- **Performance regressions** — changes that significantly slow down the library
5746

58-
### Documentation
59-
- Every exported function has a doc comment starting with the function name, describing the outcome (not the implementation), and noting edge cases.
60-
- Package-level doc comment in `dig.go`.
47+
## Contribution Process
6148

62-
### Dependencies
63-
- **Zero external dependencies.** `dig` is pure stdlib.
49+
### 1. Create an Issue First
6450

65-
## 🧪 Testing
51+
For significant changes, please create an issue to discuss:
52+
- What problem you're solving
53+
- Your proposed approach
54+
- Any potential breaking changes
6655

67-
**Coverage target: 100% of exported functions.**
56+
### 2. Development Workflow
6857

69-
```bash
70-
go test -v ./... # verbose
71-
go test -race ./... # race detection
72-
go test -cover ./... # coverage
73-
go test -bench=. -benchmem ./... # benchmarks with allocations
74-
```
58+
1. **Create a feature branch**:
59+
```bash
60+
git checkout -b feature/your-feature-name
61+
```
7562

76-
- Table-driven tests preferred for functions with many input combinations
77-
- Every exported function has a corresponding benchmark in `bench_test.go`
78-
- Unicode-safe coverage for any string-handling operation
63+
2. **Make your changes** — follow the code style guidelines below, add tests, update documentation as needed.
7964

80-
## 📝 Pull Request Process
65+
3. **Validate your changes**:
66+
```bash
67+
go fmt ./...
68+
go vet ./...
69+
go test -race ./...
70+
```
8171

82-
### PR Checklist
72+
4. **Commit your changes**:
73+
```bash
74+
git commit -m "feat: add your feature description"
75+
```
8376

84-
Before submitting, verify your PR against the four principles:
77+
5. **Push and create a pull request**:
78+
```bash
79+
git push origin feature/your-feature-name
80+
```
8581

86-
- [ ] **Outcome naming** — does the function name describe what the caller gets?
87-
- [ ] **One way** — does any existing function (this library or stdlib) already do this? If yes, stop.
88-
- [ ] **Get out of the way** — can a Go dev use this from the signature alone?
89-
- [ ] **Non-goals** — does this violate any of the library's stated non-goals?
82+
### 3. Pull Request Guidelines
9083

91-
Additionally:
92-
- [ ] Tests cover 100% of new code
93-
- [ ] Benchmarks added for new exported functions
94-
- [ ] README updated (if adding or changing exported functions)
95-
- [ ] CHANGELOG.md updated
96-
- [ ] `./scripts/validate.sh ci` passes locally
84+
Your PR should:
85+
- Have a clear title describing the change
86+
- Reference any related issues using `Fixes #123` or `Closes #123`
87+
- Include tests for new functionality
88+
- Pass all CI checks
89+
- Maintain backward compatibility unless discussed otherwise
9790

98-
### PR Scope
99-
- **One function per PR** when adding new functionality
100-
- Bug fixes can be grouped if they share a root cause
101-
- Documentation-only changes can be batched
91+
## Code Style
10292

103-
### PR Description Template
93+
- Follow standard Go formatting (`go fmt`)
94+
- Use meaningful variable and function names
95+
- Write clear, concise comments for public APIs
96+
- Follow Go's error handling patterns
97+
- Write table-driven tests where appropriate
98+
- Test both success and error cases
99+
- Include edge cases (nil values, empty strings, etc.)
100+
- Run tests with `-race` to ensure thread safety
104101

105-
```
106-
## What
107-
One sentence describing the change.
108-
109-
## Why
110-
Real-world evidence of the pain this solves. Link to code, open-source example,
111-
or specific stdlib gap.
102+
## Commit Messages
112103

113-
## Principles Check
114-
- Outcome naming: [how the name passes the "say it aloud" test]
115-
- One way: [verified no stdlib or existing function does this]
116-
- Get out of the way: [signature alone is enough]
117-
- Non-goals: [confirmed no non-goal violated]
104+
We follow conventional commits:
118105

119-
## Breaking Changes
120-
None / [describe]
106+
```
107+
type(scope): description
121108
```
122109

123-
## 🆕 Adding a New Function
124-
125-
`dig` is deliberately tiny (four functions). New additions are rare and must clear a high bar:
126-
127-
1. Read the library's non-goals in [README.md](README.md#-related-projects) and [PRINCIPLES.md](https://github.com/bold-minds/oss/blob/main/PRINCIPLES.md). If the function violates one, stop.
128-
2. Apply the four-principles checklist above.
129-
3. **Prove the stdlib gap.** Search [pkg.go.dev](https://pkg.go.dev/) for equivalents. If stdlib has it, don't ship it.
130-
4. **Show real-world evidence.** Either a codebase using the pattern today, or a verifiable open-source example. Theoretical usefulness is not enough.
131-
5. Draft the function signature and README section first. Open a discussion issue for feedback before writing implementation.
132-
6. Implement, test, benchmark, document.
133-
7. Submit PR with one function per PR.
134-
135-
## 🏷️ Versioning and Releases
136-
137-
- **Semantic versioning**: `vMAJOR.MINOR.PATCH`
138-
- **v0.x**: API may change between minor versions (pre-1.0 signaling)
139-
- **v1.0+**: breaking changes require a major version bump
140-
- Every release updates `CHANGELOG.md`
141-
- Releases are tagged in git and published via `go mod` automatically
142-
143-
## 🙏 Code of Conduct
144-
145-
See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
110+
Types: `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `chore`
146111

147-
## 📄 License
112+
## Code Review
148113

149-
By contributing, you agree your contributions are licensed under the MIT License (see [LICENSE](LICENSE)).
114+
We look for: correctness, performance, style, tests, documentation, and backward compatibility. Initial review within 2-3 business days.
150115

151-
## Questions?
116+
## License
152117

153-
Open a discussion issue in this repository.
118+
By contributing, you agree that your contributions will be licensed under the same license that covers the project.

0 commit comments

Comments
 (0)