tizen 2.4 release
[external/nghttp2.git] / doc / sources / contribute.rst
1 Contribution Guidelines
2 =======================
3
4 [This text was composed based on 1.2. License section of curl/libcurl
5 project.]
6
7 When contributing with code, you agree to put your changes and new
8 code under the same license nghttp2 is already using unless stated and
9 agreed otherwise.
10
11 When changing existing source code, you do not alter the copyright of
12 the original file(s).  The copyright will still be owned by the
13 original creator(s) or those who have been assigned copyright by the
14 original author(s).
15
16 By submitting a patch to the nghttp2 project, you are assumed to have
17 the right to the code and to be allowed by your employer or whatever
18 to hand over that patch/code to us.  We will credit you for your
19 changes as far as possible, to give credit but also to keep a trace
20 back to who made what changes.  Please always provide us with your
21 full real name when contributing!
22
23 Coding style
24 ------------
25
26 We use clang-format to format source code consistently.  The
27 clang-format configuration file .clang-format is located at the root
28 directory.  Since clang-format produces slightly different results
29 between versions, we currently use clang-format which comes with
30 clang-3.5.
31
32 To detect any violation to the coding style, we recommend to setup git
33 pre-commit hook to check coding style of the changes you introduced.
34 The pre-commit file is located at the root directory.  Copy it under
35 .git/hooks and make sure that it is executable.  The pre-commit script
36 uses clang-format-diff.py to detect any style errors.  If it is not in
37 your PATH or it exists under different name (e.g.,
38 clang-format-diff-3.5 in debian), either add it to PATH variable or
39 add git option ``clangformatdiff.binary`` to point to the script.
40
41 For emacs users, integrating clang-format to emacs is very easy.
42 clang-format.el should come with clang distribution.  If it is not
43 found, download it from `here
44 <https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.el>`_.
45 And add these lines to your .emacs file:
46
47 .. code-block:: lisp
48
49     ;; From
50     ;; https://code.google.com/p/chromium/wiki/Emacs#Use_Google's_C++_style!
51     (load "/<path/to>/clang-format.el")
52     (add-hook 'c-mode-common-hook
53          (function (lambda () (local-set-key (kbd "TAB")
54                                              'clang-format-region))))
55
56 You can find other editor integration in
57 http://clang.llvm.org/docs/ClangFormat.html.