Skip to content

Commit fc886e8

Browse files
committed
Add pre-commit hook for contribute documentation.
* Also add a soft link for contribute.md to make github recognize this file.
1 parent f8e8d1a commit fc886e8

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./doc/howto/contribute_to_paddle_en.md

doc/howto/contribute_to_paddle_en.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# How to Contribute Code
22

33
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+
66
## Code Requirements
77
- Your code must be fully documented by
88
[doxygen](http://www.stack.nl/~dimitri/doxygen/) style.
@@ -12,11 +12,11 @@ workflow to merge your code.
1212
- Pass all unit tests.
1313

1414
The following tutorial guides you into submitting your contibution.
15-
15+
1616
## [Creating a Fork](https://help.github.com/articles/fork-a-repo/)
17-
17+
1818
Just head over to the GitHub page and click the "Fork" button.
19-
It's just that simple.
19+
It's just that simple.
2020

2121
## Clone
2222

@@ -25,7 +25,7 @@ The **develop** is the main branch, and other user's branches are feature branch
2525

2626
Once you've created a fork, you can use your favorite git client to clone your
2727
repo or just head straight to the command line:
28-
28+
2929
```shell
3030
# Clone your fork to your local machine
3131
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
4747
git checkout -b MY_COOL_STUFF_BRANCH
4848
```
4949

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+
5066
## Commit
5167

5268
Commit your changes by following command lines:
@@ -83,7 +99,7 @@ git pull --rebase upstream develop
8399

84100
If there are no unique commits locally, git will simply perform a fast-forward.
85101
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.
87103

88104
Now, your local master branch is up-to-date with everything modified upstream.
89105

0 commit comments

Comments
 (0)