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