Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 9f56de6

Browse files
authored
Update contribution guide and pull request template (#1091)
[Tekton project](https://github.com/tektoncd/community/blob/main/standards.md) already has instructions that align with our values, and hence the important sections are borrowed from there. Signed-off-by: Predrag Knezevic <[email protected]>
1 parent 335c3d1 commit 9f56de6

File tree

3 files changed

+123
-23
lines changed

3 files changed

+123
-23
lines changed

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 -->
2+
3+
# Changes
4+
5+
<!--
6+
Describe your changes here- ideally you can get that description straight from your descriptive commit message(s)!
7+
8+
In addition, categorize the changes you're making using the "/kind" Prow command, example:
9+
10+
/kind <kind>
11+
12+
Supported kinds are: bug, test, documentation, enhancement
13+
-->
14+
15+
# Submitter Checklist
16+
17+
As the author of this PR, please check off the items in this checklist:
18+
19+
- [ ] [Docs](https://github.com/redhat-developer/service-binding-operator/blob/master/CONTRIBUTING.md#docs)
20+
included if any changes are user facing
21+
- [ ] [Tests](https://github.com/redhat-developer/service-binding-operator/blob/master/CONTRIBUTING.md#tests)
22+
included if any functionality added or changed. For bugfixes please include tests that can catch regressions
23+
- [ ] Follows the [commit message standard](https://github.com/redhat-developer/service-binding-operator/blob/master/CONTRIBUTING.md#commits)
24+

CONTRIBUTING.md

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Enhancements and requests for new features are also tracked as [GitHub issues](h
124124
As is the case with bugs, review the existing feature requests before logging
125125
a new request.
126126

127-
### Pull Requests for Code and Documentation
127+
## Pull Requests
128128

129129
All submitted code and document changes are reviewed by the project
130130
maintainers through pull requests.
@@ -137,16 +137,108 @@ Include an informative title and full details on the code changed/added in
137137
the git commit message and pull request description.
138138

139139
Before submitting the pull request, verify that all existing tests run
140-
cleanly by executing unit and acceptance tests with this make target:
140+
cleanly.
141141

142-
```bash
143-
make test
144-
```
145142
Be sure to run yamllint on all yaml files included in pull requests. Ensure
146143
that all text in files in pull requests is compliant with:
147144
[.editorconfig](.editorconfig)
148145

149-
### Pull Request Workflow
146+
Each Pull Request is expected to meet the following expectations around:
147+
148+
* [Pull Request Description](#pull-request-description)
149+
* [Commits](#commits)
150+
* [Docs](#docs)
151+
* [Functionality](#functionality)
152+
* [Code](#code)
153+
* [Tests](#tests)
154+
155+
## Pull request description
156+
157+
Include a link to the issue being addressed, but describe the context for the reviewer
158+
* If there is no issue, consider whether there should be one:
159+
* New functionality must be designed and approved, may require a TEP
160+
* Bugs should be reported in detail
161+
* If the template contains a checklist, it should be checked off
162+
* Release notes filled in for user visible changes (bugs + features),
163+
or removed if not applicable (refactoring, updating tests) (may be enforced
164+
via the [release-note Prow plugin](https://github.com/tektoncd/plumbing/blob/main/prow/plugins.yaml))
165+
166+
### Commits
167+
168+
* Use the body to explain [what and why vs. how](https://chris.beams.io/posts/git-commit/#why-not-how).
169+
Link to an issue whenever possible and [aim for 2 paragraphs](https://www.youtube.com/watch?v=PJjmw9TRB7s),
170+
e.g.:
171+
* What is the problem being solved?
172+
* Why is this the best approach?
173+
* What other approaches did you consider?
174+
* What side effects will this approach have?
175+
* What future work remains to be done?
176+
* Prefer one commit per PR. For multiple commits ensure each makes sense without the context of the others.
177+
* As much as possible try to stick to these general formatting guidelines:
178+
* Separate subject line from message body.
179+
* Write the subject line using the "imperative mood" ([see examples](https://chris.beams.io/posts/git-commit/#imperative)).
180+
* Keep the subject to 50 characters or less.
181+
* Try to keep the message wrapped at 72 characters.
182+
* Check [these seven best practices](https://chris.beams.io/posts/git-commit/#seven-rules) for more detail.
183+
184+
### Example Commit Message
185+
186+
Here's a commit message example to work from that sticks to the spirit
187+
of the guidance outlined above:
188+
189+
```
190+
Add example commit message to demo our guidance
191+
192+
Prior to this message being included in our standards there was no
193+
canonical example of an "ideal" commit message for devs to quickly copy.
194+
195+
Providing a decent example helps clarify the intended outcome of our
196+
commit message rules and offers a template for people to work from. We
197+
could alternatively link to good commit messages in our repos but that
198+
requires developers to follow more links rather than just showing
199+
what we want.
200+
```
201+
202+
### Docs
203+
204+
* Include AsciiDoc [doc updates](docs/userguide) for user visible features
205+
* We use [Antora framework](https://docs.antora.org/antora/latest/) for AsciiDoc rendering
206+
* Spelling and grammar should be correct
207+
* Try to make formatting look as good as possible (use preview mode to check, i.e. render the content locally using `make site`)
208+
* Should explain thoroughly how the new feature works
209+
* If possible, in addition to code snippets, include a reference to an end to end example
210+
* Ensure that all links and references are valid
211+
212+
### Functionality
213+
214+
It should be safe to cut a release at any time, i.e. merging this PR should not
215+
put us into an unreleasable state
216+
217+
## Code
218+
219+
* Reviewers are expected to understand the changes well enough that they would feel confident
220+
saying the understand what is changing and why:
221+
* Read through all the code changes
222+
* Read through linked issues and pull requests, including the discussions
223+
* Prefer small well factored packages with unit tests
224+
* [Go Code Review comments](https://github.com/golang/go/wiki/CodeReviewComments)
225+
* All public functions and attributes have docstrings
226+
* Don’t panic
227+
* Error strings are not capitalized
228+
* Handle all errors ([gracefully](https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully))
229+
* When returning errors, add more context with `fmt.Errorf` and `%v`
230+
* Use meaningful package names (avoid util, helper, lib)
231+
* Prefer short variable names
232+
233+
### Tests
234+
235+
* New features (and often/whenever possible bug fixes) have one or all of:
236+
* Unit tests
237+
* End to end, i.e. acceptance tests
238+
* Unit tests:
239+
* Coverage should remain the same or increase
240+
241+
## Pull Request Workflow
150242

151243
- Fork the repository and clone it your work directory
152244
- Create a topic branch from where you want to base your work
@@ -157,7 +249,6 @@ that all text in files in pull requests is compliant with:
157249
my-bug-fix upstream/master` (Here `upstream` is alias for the remote repo)
158250
- Make commits of logical units
159251
- Make sure your commit messages are in [the proper format][commit-message].
160-
Also include any related GitHub issue references in the commit message.
161252
- Push your changes to a topic branch in your fork of the repository
162253
- Submit a pull request
163254

@@ -167,7 +258,7 @@ Example:
167258
git remote add upstream https://github.com/kubepreset/kubepreset.git
168259
git fetch upstream
169260
git checkout -b my-bug-fix upstream/master
170-
git commit -a
261+
git commit -s
171262
git push origin my-bug-fix
172263
```
173264

docs/pull_request_template.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)