Skip to content
Oliver Lau edited this page Jan 25, 2016 · 15 revisions

How to contribute

In a nutshell

The Qt-SESAM team would be glad if you like to contribute to the code. To do so, please fork the repository, create a clone of the forked repository on your local computer, add your code, test it thoroughly, check in your changes, then send us a pull request with the proposed changes.

Coding guidelines

Please adhere to the following C++ code style to maintain consistency across all .h and .cpp files:

  • Use Stroustrup's indentation style with two (2) spaces per indent:
    • Put curly braces on same line for for/while/if….
    • Put curly braces on next line for function, class and struct definitions.
    • Do not indent braces further than the preceding line.
    • Do not use a "cuddled" else, i.e. an else on the same line after the closing curly brace of if block.
    • Enclose single-line blocks with curly braces, e.g. after if or else. Exception: A single-line block with only a return doesn't need to be enclosed with braces.
  • Use void to denote an empty argument list, e.g. int generateUid(void).
  • Use CamelCase identifiers with first character in lowercase for variables (thisIsAVariable), in uppercase for classes and constants/enums (MyClass, MyConstant).
  • Don't use underscores in identifiers (disallowed_name_or_method, _alsoUnwanted).
  • Use private member variables managed by a QScopedPointer pointing to a separate class (see Using Private Classes and D-Pointers, concise example in tcpclient.h/tcpclient.cpp).
  • Omit type hints in identifiers (e.g. pszName to identify a pointer to a zero-terminated string is not acceptable).
  • Bind * and & in types/declarations to identifier (e.g. int *value = Q_NULLPTR;) and right const/volatile (e.g. int *const *value;).
  • Use speaking identifiers.
  • Header files have to be suffixed by .h, C++ code files by .cpp.
  • Please implement all functionality in .cpp files, not in the header files.

Keep up to date

Before you send us a pull request it's mandatory that you first update the branch you're working on with the latest changes from the repository you forked from. For this to happen you have to configure a remote that points to the upstream repository once for the local clone of your fork:

git remote add upstream https://github.com/ola-ct/Qt-SESAM.git

After that you can sync the fork. First, fetch the branches and their respective commits from the upstream repository:

git fetch upstream

Then make sure that "master" is up to date by making it the active branch and merging the most recent commits from the upstream repository:

git checkout master
git merge upstream/master

Working on a new issue

It's not recommended to work on issues that are not known to the public. If no appropriate issue has been filed, please do so before you commence. You'll need the issue number (#…) for further reference.

Let's say you want to work on issue #987 then create a new branch to work in:

git checkout -b Issue-987

Please always follow the scheme "Issue-xy" (where xy denotes the issue number) to name a branch.

You can now make your changes.

Before committing with git commit … please test your code extensively.

After committing and before pushing you have to update your branch with the potential changes found in the master branch: After executing the steps described in "Keep up to date" type:

git merge master

If merge conflicts occured, resolve them. Then test again before committing.

You may then push the changes to your fork:

git push -u origin Issue-987

The -u tells git to add a remote for that branch. You can omit this switch in later pushes.

If you'd like to share your changes please send us a pull request.

Working on an existing branch

If you've never worked on the branch you want to modify, you have to pull the branch from upstream:

git pull upstream Issue-987

If the branch already exists in your fork you can skip that step and directly enter that branch:

git checkout Issue-987

Licenses

Qt-SESAM is licensed under the GNU General Public License v3 or later. So please take care not to use (third-party) code which doesn't comply to this license.