@@ -124,7 +124,7 @@ Enhancements and requests for new features are also tracked as [GitHub issues](h
124
124
As is the case with bugs, review the existing feature requests before logging
125
125
a new request.
126
126
127
- ### Pull Requests for Code and Documentation
127
+ ## Pull Requests
128
128
129
129
All submitted code and document changes are reviewed by the project
130
130
maintainers through pull requests.
@@ -137,16 +137,108 @@ Include an informative title and full details on the code changed/added in
137
137
the git commit message and pull request description.
138
138
139
139
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.
141
141
142
- ``` bash
143
- make test
144
- ```
145
142
Be sure to run yamllint on all yaml files included in pull requests. Ensure
146
143
that all text in files in pull requests is compliant with:
147
144
[ .editorconfig] ( .editorconfig )
148
145
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
150
242
151
243
- Fork the repository and clone it your work directory
152
244
- 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:
157
249
my-bug-fix upstream/master` (Here ` upstream` is alias for the remote repo)
158
250
- Make commits of logical units
159
251
- Make sure your commit messages are in [ the proper format] [ commit-message ] .
160
- Also include any related GitHub issue references in the commit message.
161
252
- Push your changes to a topic branch in your fork of the repository
162
253
- Submit a pull request
163
254
@@ -167,7 +258,7 @@ Example:
167
258
git remote add upstream https://github.com/kubepreset/kubepreset.git
168
259
git fetch upstream
169
260
git checkout -b my-bug-fix upstream/master
170
- git commit -a
261
+ git commit -s
171
262
git push origin my-bug-fix
172
263
```
173
264
0 commit comments