Skip to content

Commit a8a1aa9

Browse files
Add guidance as to what makes a good change request
Address Baohua comment to add commit msg guidance Change-Id: I70fe7e59d2121635f67477a36b83fe58dbe42a5b Signed-off-by: Christopher Ferris <[email protected]>
1 parent 051229a commit a8a1aa9

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

docs/CONTRIBUTING.md

+58
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,64 @@ the `lf-sandbox`
7979
you should be ready to set up your local development
8080
[environment](dev-setup/devenv.md).
8181

82+
## What makes a good change request?
83+
84+
* One change at a time. Not five, not three, not ten. One and only one. Why?
85+
Because it limits the blast area of the change. If we have a regression, it is
86+
much easier to identify the culprit commit than if we have some composite
87+
change that impacts more of the code.
88+
89+
* Include a link to the JIRA story for the change. Why? Because a) we want to
90+
track our velocity to better judge what we think we can deliver and when and b)
91+
because we can justify the change more effectively. In many cases, there
92+
should be some discussion around a proposed change and we want to link back to
93+
that from the change itself.
94+
95+
* Include unit and integration tests (or changes to existing tests) with every
96+
change. This does not mean just happy path testing, either. It also means
97+
negative testing of any defensive code that it correctly catches input errors.
98+
When you write code, you are responsible to test it and provide the tests that
99+
demonstrate that your change does what it claims. Why? Because
100+
without this we have no clue whether our current code base actually works.
101+
102+
* Unit tests should have NO external dependencies. You should be able to run
103+
unit tests in place with `go test` or equivalent for the language. Any test
104+
that requires some external dependency (e.g. needs to be scripted to run another
105+
component) needs appropriate mocking. Anything else is not unit testing, it is
106+
integration testing by definition. Why? Because many open source developers
107+
do Test Driven Development. They place a watch on the directory that invokes
108+
the tests automagically as the code is changed. This is far more efficient
109+
than having to run a whole build between code changes.
110+
111+
* Minimize the lines of code per CR. Why? Maintainers have day jobs, too. If
112+
you send a 1,000 or 2,000 LOC change, how long do you think it takes to review
113+
all of that code? Keep your changes to < 200-300 LOC if possible. If you have a
114+
larger change, decompose it into multiple independent changess. If you are adding
115+
a bunch of new functions to fulfill the requirements of a new capability, add
116+
them separately with their tests, and then write the code that uses them to
117+
deliver the capability. Of course, there are always exceptions. If you add a
118+
small change and then add 300 LOC of tests, you will be forgiven;-)
119+
If you need to make a change that has broad impact or a bunch of generated
120+
code (protobufs, etc.). Again, there can be exceptions.
121+
122+
* Write a meaningful commit message. Include a meaningful 50 (or less) character
123+
title, followed by a blank line, followed my a more comprehensive description
124+
of the change. Be sure to include the JIRA identifier corresponding to the
125+
change (e.g. [FAB-1234]). This can be in the title but should also be in the
126+
body of the commit message.
127+
128+
e.g.
129+
```
130+
[FAB-1234] fix foobar() panic
131+
132+
Fix [FAB-1234] added a check to ensure that when foobar(foo string) is called,
133+
that there is a non-empty string argument.
134+
```
135+
136+
Finally, be responsive. Don't let a change request fester with review comments
137+
such that it gets to a point that it requires a rebase. It only further delays
138+
getting it merged and adds more work for you - to remediate the merge conflicts.
139+
82140
## Coding guidelines
83141

84142
Be sure to check out the language-specific [style guides](Style-guides/go-style.md)

0 commit comments

Comments
 (0)