1
1
# How to Contribute Code
2
2
3
3
We sincerely appreciate your contributions. You can use fork and pull request
4
- workflow to merge your code.
5
-
4
+ workflow to merge your code.
5
+
6
6
## Code Requirements
7
7
- Your code must be fully documented by
8
8
[ doxygen] ( http://www.stack.nl/~dimitri/doxygen/ ) style.
@@ -12,11 +12,11 @@ workflow to merge your code.
12
12
- Pass all unit tests.
13
13
14
14
The following tutorial guides you into submitting your contibution.
15
-
15
+
16
16
## [ Creating a Fork] ( https://help.github.com/articles/fork-a-repo/ )
17
-
17
+
18
18
Just head over to the GitHub page and click the "Fork" button.
19
- It's just that simple.
19
+ It's just that simple.
20
20
21
21
## Clone
22
22
@@ -25,7 +25,7 @@ The **develop** is the main branch, and other user's branches are feature branch
25
25
26
26
Once you've created a fork, you can use your favorite git client to clone your
27
27
repo or just head straight to the command line:
28
-
28
+
29
29
``` shell
30
30
# Clone your fork to your local machine
31
31
git clone --branch develop https://github.com/USERNAME/Paddle.git
@@ -47,6 +47,22 @@ Then you can start to develop by making a local developement branch
47
47
git checkout -b MY_COOL_STUFF_BRANCH
48
48
```
49
49
50
+ ## Using ` pre-commit ` hook
51
+
52
+ Paddle developers use [ pre-commit] ( http://pre-commit.com/ ) tool to manage git
53
+ pre-commit hooks. It can help us format source codes (cpp, python), check some
54
+ basic thing before commit (only one EOL for each file, do not add a huge file
55
+ in git). ` pre-commit ` tests is a part of unit tests in Travis-CI now, every
56
+ PR doesn't fit hook can not be merged into Paddle.
57
+
58
+ To use [ pre-commit] ( http://pre-commit.com/ ) , you should install it by
59
+ ` pip install pre-commit ` , and currently, Paddle uses ` clang-format ` to format
60
+ c/cpp sources. Please make sure clang-format 3.8+ installed.
61
+
62
+ Then just run ` pre-commit install ` in your Paddle clone directory. When you
63
+ commit your code, the pre-commit hook will check the local code if there is
64
+ anything not suitable to commit, and so on.
65
+
50
66
## Commit
51
67
52
68
Commit your changes by following command lines:
@@ -83,7 +99,7 @@ git pull --rebase upstream develop
83
99
84
100
If there are no unique commits locally, git will simply perform a fast-forward.
85
101
However, if you have been making changes (in the vast majority of cases you
86
- probably shouldn't be), you may have to deal with conflicts.
102
+ probably shouldn't be), you may have to deal with conflicts.
87
103
88
104
Now, your local master branch is up-to-date with everything modified upstream.
89
105
0 commit comments