2015-06-07 23:07:20 -04:00
|
|
|
<!--[metadata]>
|
|
|
|
+++
|
|
|
|
title = "Coding style checklist"
|
|
|
|
description = "List of guidelines for coding Docker contributions"
|
|
|
|
keywords = ["change, commit, squash, request, pull request, test, unit test, integration tests, Go, gofmt, LGTM"]
|
|
|
|
[menu.main]
|
2015-06-16 09:04:13 -04:00
|
|
|
parent = "smn_contribute"
|
|
|
|
weight=7
|
2015-06-07 23:07:20 -04:00
|
|
|
+++
|
|
|
|
<![end-metadata]-->
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-04-21 11:50:09 -04:00
|
|
|
# Coding style checklist
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
This checklist summarizes the material you experienced working through [make a
|
|
|
|
code contribution](/project/make-a-contribution) and [advanced
|
2015-04-15 17:11:58 -04:00
|
|
|
contributing](/project/advanced-contributing). The checklist applies to both
|
|
|
|
program code and documentation code.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
## Change and commit code
|
|
|
|
|
|
|
|
* Fork the `docker/docker` repository.
|
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Make changes on your fork in a feature branch. Name your branch `XXXX-something`
|
|
|
|
where `XXXX` is the issue number you are working on.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
* Run `gofmt -s -w file.go` on each changed file before
|
2015-03-07 08:06:40 -05:00
|
|
|
committing your changes. Most editors have plug-ins that do this automatically.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
* Update the documentation when creating or modifying features.
|
|
|
|
|
|
|
|
* Commits that fix or close an issue should reference them in the commit message
|
2015-03-07 08:06:40 -05:00
|
|
|
`Closes #XXXX` or `Fixes #XXXX`. Mentions help by automatically closing the
|
|
|
|
issue on a merge.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
* After every commit, run the test suite and ensure it is passing.
|
|
|
|
|
|
|
|
* Sync and rebase frequently as you code to keep up with `docker` master.
|
|
|
|
|
|
|
|
* Set your `git` signature and make sure you sign each commit.
|
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Do not add yourself to the `AUTHORS` file. This file is autogenerated from the
|
|
|
|
Git history.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
## Tests and testing
|
|
|
|
|
|
|
|
* Submit unit tests for your changes.
|
|
|
|
|
|
|
|
* Make use of the builtin Go test framework built.
|
|
|
|
|
|
|
|
* Use existing Docker test files (`name_test.go`) for inspiration.
|
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Run <a href="../test-and-docs" target="_blank">the full test suite</a> on your
|
|
|
|
branch before submitting a pull request.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
* Run `make docs` to build the documentation and then check it locally.
|
|
|
|
|
|
|
|
* Use an <a href="http://www.hemingwayapp.com" target="_blank">online grammar
|
2015-03-07 08:06:40 -05:00
|
|
|
checker</a> or similar to test you documentation changes for clarity,
|
|
|
|
concision, and correctness.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
## Pull requests
|
|
|
|
|
|
|
|
* Sync and cleanly rebase on top of Docker's `master` without multiple branches
|
2015-03-07 08:06:40 -05:00
|
|
|
mixed into the PR.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Before the pull request, squash your commits into logical units of work using
|
|
|
|
`git rebase -i` and `git push -f`.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Include documentation changes in the same commit so that a revert would
|
|
|
|
remove all traces of the feature or fix.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
* Reference each issue in your pull request description (`#XXXX`)
|
|
|
|
|
|
|
|
## Respond to pull requests reviews
|
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Docker maintainers use LGTM (**l**ooks-**g**ood-**t**o-**m**e) in PR comments
|
|
|
|
to indicate acceptance.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Code review comments may be added to your pull request. Discuss, then make
|
|
|
|
the suggested modifications and push additional commits to your feature
|
|
|
|
branch.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Incorporate changes on your feature branch and push to your fork. This
|
|
|
|
automatically updates your open pull request.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* Post a comment after pushing to alert reviewers to PR changes; pushing a
|
|
|
|
change does not send notifications.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* A change requires LGTMs from an absolute majority maintainers of an
|
|
|
|
affected component. For example, if you change `docs/` and `registry/` code,
|
|
|
|
an absolute majority of the `docs/` and the `registry/` maintainers must
|
|
|
|
approve your PR.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
|
|
|
## Merges after pull requests
|
|
|
|
|
2015-06-03 15:08:40 -04:00
|
|
|
* After a merge, [a master build](https://master.dockerproject.org/) is
|
2015-03-07 08:06:40 -05:00
|
|
|
available almost immediately.
|
2015-03-06 13:01:31 -05:00
|
|
|
|
2015-03-07 08:06:40 -05:00
|
|
|
* If you made a documentation change, you can see it at
|
2015-06-03 15:08:40 -04:00
|
|
|
[docs.master.dockerproject.org](http://docs.master.dockerproject.org/).
|