Blame CONTRIBUTING.md

Packit 209faa
Contributing code to Kyua
Packit 209faa
=========================
Packit 209faa
Packit 209faa
Want to contribute?  Great!  But first, please take a few minutes to read this
Packit 209faa
document in full.  Doing so upfront will minimize the turnaround time required
Packit 209faa
to get your changes incorporated.
Packit 209faa
Packit 209faa
Packit 209faa
Legal notes
Packit 209faa
-----------
Packit 209faa
Packit 209faa
* Before we can use your code, you must sign the
Packit 209faa
  [Google Individual Contributor License
Packit 209faa
  Agreement](https://developers.google.com/open-source/cla/individual),
Packit 209faa
  also known as the CLA, which you can easily do online.  The CLA is necessary
Packit 209faa
  mainly because you own the copyright to your changes, even after your
Packit 209faa
  contribution becomes part of our codebase, so we need your permission to use
Packit 209faa
  and distribute your code.  We also need to be sure of various other
Packit 209faa
  things--for instance that you will tell us if you know that your code
Packit 209faa
  infringes on other people's patents.  You do not have to sign the CLA until
Packit 209faa
  after you have submitted your code for review and a member has approved it,
Packit 209faa
  but you must do it before we can put your code into our codebase.
Packit 209faa
Packit 209faa
* Contributions made by corporations are covered by a different agreement than
Packit 209faa
  the one above: the
Packit 209faa
  [Google Software Grant and Corporate Contributor License
Packit 209faa
  Agreement](https://developers.google.com/open-source/cla/corporate).
Packit 209faa
  Please get your company to sign this agreement instead if your contribution is
Packit 209faa
  on their behalf.
Packit 209faa
Packit 209faa
* Unless you have a strong reason not to, please assign copyright of your
Packit 209faa
  changes to Google Inc. and use the 3-clause BSD license text included
Packit 209faa
  throughout the codebase (see [LICENSE](LICENSE)).  Keeping the whole project
Packit 209faa
  owned by a single entity is important, particularly to avoid the problem of
Packit 209faa
  having to replicate potentially hundreds of different copyright notes in
Packit 209faa
  documentation materials, etc.
Packit 209faa
Packit 209faa
Packit 209faa
Communication
Packit 209faa
-------------
Packit 209faa
Packit 209faa
* Before you start working on a larger contribution, you should get in touch
Packit 209faa
  with us first through the
Packit 209faa
  [kyua-discuss mailing
Packit 209faa
  list](https://groups.google.com/forum/#!forum/kyua-discuss)
Packit 209faa
  with your idea so that we can help out and possibly guide you.  Coordinating
Packit 209faa
  upfront makes it much easier to avoid frustration later on.
Packit 209faa
Packit 209faa
* Subscribe to the
Packit 209faa
  [kyua-log mailing list](https://groups.google.com/forum/#!forum/kyua-log) to
Packit 209faa
  get notifications on new commits, Travis CI results, or changes to bugs.
Packit 209faa
Packit 209faa
Packit 209faa
Git workflow
Packit 209faa
------------
Packit 209faa
Packit 209faa
* Always work on a non-master branch.
Packit 209faa
Packit 209faa
* Make sure the history of your branch is clean.  (Ab)use `git rebase -i master`
Packit 209faa
  to ensure the sequence of commits you want pulled is easy to follow and that
Packit 209faa
  every commit does one (and only one) thing.  In particular, commits of the
Packit 209faa
  form `Fix previous` or `Fix build` should never ever exist; merge those fixes
Packit 209faa
  into the relevant commits so that the history is clean at pull time.
Packit 209faa
Packit 209faa
* Always trigger Travis CI builds for your changes (hence why working on a
Packit 209faa
  branch is important).  Push your branch to GitHub so that Travis CI picks it
Packit 209faa
  up and performs a build.  If you have forked the repository, you may need to
Packit 209faa
  enable Travis CI builds on your end.  Wait for a green result.
Packit 209faa
Packit 209faa
* It is OK and expected for you to `git push --force` on **non-master**
Packit 209faa
  branches.  This is required if you need to go through the commit/test cycle
Packit 209faa
  more than once for any given branch after you have "fixed-up" commits to
Packit 209faa
  correct problems spotted in earlier builds.
Packit 209faa
Packit 209faa
* Do not send pull requests that subsume other/older pull requests.  Each major
Packit 209faa
  change being submitted belongs in a different pull request, which is trivial
Packit 209faa
  to achieve if you use one branch per change as requested in this workflow.
Packit 209faa
Packit 209faa
Packit 209faa
Code reviews
Packit 209faa
------------
Packit 209faa
Packit 209faa
* All changes will be subject to code reviews pre-merge time.  In other words:
Packit 209faa
  all pull requests will be carefully inspected before being accepted and they
Packit 209faa
  will be returned to you with comments if there are issues to be fixed.
Packit 209faa
Packit 209faa
* Be careful of stylistic errors in your code (see below for style guidelines).
Packit 209faa
  Style violations hinder the review process and distract from the actual code.
Packit 209faa
  By keeping your code clean of style issues upfront, you will speed up the
Packit 209faa
  review process and avoid frustration along the way.
Packit 209faa
Packit 209faa
* Whenever you are ready to submit a pull request, review the *combined diff*
Packit 209faa
  you are requesting to be pulled and look for issues.  This is the diff that
Packit 209faa
  will be subject to review, not necessarily the individual commits.  You can
Packit 209faa
  view this diff in GitHub at the bottom of the `Open a pull request` form that
Packit 209faa
  appears when you click the button to file a pull request, or you can see the
Packit 209faa
  diff by typing `git diff <your-branch> master`.
Packit 209faa
Packit 209faa
Packit 209faa
Commit messages
Packit 209faa
---------------
Packit 209faa
Packit 209faa
* Follow standard Git commit message guidelines.  The first line has a maximum
Packit 209faa
  length of 50 characters, does not terminate in a period, and has to summarize
Packit 209faa
  the whole commit.  Then a blank line comes, and then multiple plain-text
Packit 209faa
  paragraphs provide details on the commit if necessary with a maximum length of
Packit 209faa
  72-75 characters per line.  Vim has syntax highlighting for Git commit
Packit 209faa
  messages and will let you know when you go above the maximum line lengths.
Packit 209faa
Packit 209faa
* Use the imperative tense.  Say `Add foo-bar` or `Fix baz` instead of `Adding
Packit 209faa
  blah`, `Adds bleh`, or `Added bloh`.
Packit 209faa
Packit 209faa
Packit 209faa
Handling bug tracker issues
Packit 209faa
---------------------------
Packit 209faa
Packit 209faa
* All changes pushed to `master` should cross-reference one or more issues in
Packit 209faa
  the bug tracker.  This is particularly important for bug fixes, but also
Packit 209faa
  applies to major feature improvements.
Packit 209faa
Packit 209faa
* Unless you have a good reason to do otherwise, name your branch `issue-N`
Packit 209faa
  where `N` is the number of the issue being fixed.
Packit 209faa
Packit 209faa
* If the fix to the issue can be done *in a single commit*, terminate the commit
Packit 209faa
  message with `Fixes #N.` where `N` is the number of the issue being fixed and
Packit 209faa
  include a note in `NEWS` about the issue in the same commit.  Such fixes can
Packit 209faa
  be merged onto master using fast-forward (the default behavior of `git
Packit 209faa
  merge`).
Packit 209faa
Packit 209faa
* If the fix to the issue requires *more than one commit*, do **not** include
Packit 209faa
  `Fixes #N.` in any of the individual commit messages of the branch nor include
Packit 209faa
  any changes to the `NEWS` file in those commits.  These "announcement" changes
Packit 209faa
  belong in the merge commit onto `master`, which is done by `git merge --no-ff
Packit 209faa
  --no-commit your-branch`, followed by an edit of `NEWS`, and terminated with a
Packit 209faa
  `git commit -a` with the proper note on the bug being fixed.
Packit 209faa
Packit 209faa
Packit 209faa
Style guide
Packit 209faa
-----------
Packit 209faa
Packit 209faa
These notes are generic and certainly *non-exhaustive*:
Packit 209faa
Packit 209faa
* Respect formatting of existing files.  Note where braces are placed, number of
Packit 209faa
  blank lines between code chunks, how continuation lines are indented, how
Packit 209faa
  docstrings are typed, etc.
Packit 209faa
Packit 209faa
* Indentation is *always* done using spaces, not tabs.  The only exception is in
Packit 209faa
  `Makefile`s, where any continuation line within a target must be prefixed by a
Packit 209faa
  *single tab*.
Packit 209faa
Packit 209faa
* [Be mindful of spelling and
Packit 209faa
  grammar.](http://julipedia.meroh.net/2013/06/readability-mind-your-typos-and-grammar.html)
Packit 209faa
  Mistakes of this kind are enough of a reason to return a pull request.
Packit 209faa
Packit 209faa
* Use proper punctuation for all sentences.  Always start with a capital letter
Packit 209faa
  and terminate with a period.
Packit 209faa
Packit 209faa
* Respect lexicographical sorting wherever possible.
Packit 209faa
Packit 209faa
* Lines must not be over 80 characters.
Packit 209faa
Packit 209faa
* No trailing whitespace.
Packit 209faa
Packit 209faa
* Two spaces after end-of-sentence periods.
Packit 209faa
Packit 209faa
* Two blank lines between functions.  If there are two blank lines among code
Packit 209faa
  blocks, they usually exist for a reason: keep them.
Packit 209faa
Packit 209faa
* In C++ code, prefix all C identifiers (those coming from `extern "C"`
Packit 209faa
  includes) with `::`.