Development/Submitting code

This describes how to submit code to the Growstuff project. For a more general overview of how to get involved in coding on Growstuff, see Development/Getting Started.

Quick version
We welcome pull requests to our github repo.

If your code relates to a story on our tracker, please include a link to it.

When to create a pull request
When:


 * 1) You have finished the work on the feature in question.
 * 2) There's still more to be done, but it's in a good, mergable state.
 * 3) You haven't finished, but want code review.

Yup, it's okay to raise a pull request even on unfinished code, but we'd prefer that you let us know that it is, so we can review it as such and suggest improvements. If it only needs a tiny improvement we might suggest a quick fix on the same branch and then re-review; otherwise, we'll usually leave feedback then close the PR without merging.

How to create a pull request
If you've never created a pull request before, here's how to do it.

First, make sure all the tests pass:

rake

Then, push your code up to github:

git push origin yourbranchname

Now go to your repo on the github website, i.e. https://github.com/YOURNAMEHERE/growstuff

Ideally you will see a message saying you have a recent branch, and giving a handy link to "compare and pull request". If so, click it. Sometimes github just doesn't show this link, though, we don't know why.

If you don't see the easy link, you will need to choose the relevant branch from the dropdown, then click on the green "compare and review" button next to the branch name:



You can also go direct to the branch at https://github.com/YOURNAMEHERE/growstuff/tree/BRANCHNAME and click the "compare and review" button from there.

Make sure your comparison is being made against "Growstuff:dev" (this is the default, so you shouldn't need to change it.)

Follow the prompts to create a pull request, then submit it.

What to write in your pull request
We appreciate good communication in pull requests. Please include:


 * a clear subject line describing the work you've done, eg. "CSV downloads for crops, harvests, and plantings"
 * a link to any relevant tracker story/ies (preferably one story per pull request, but sometimes two get done together)
 * a short description of what you've done, including:
 * any choices you made that you might want to inform the other coders of (eg. design decisions, choosing to limit the scope of the feature)
 * any known limitations of the code (eg. might be inefficient with large datasets, tests are known to break)

Code review
Anyone can review a pull request! Feel free to review other people's code and leave comments. However, only a committer can merge a pull request.

See Code review for more info.

What next?
Once your code is reviewed and found to be good, it will be merged into our "dev" branch then deployed to our staging server for acceptance testing by our customers.