Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e691d0f

Browse files
committed
Add CONTRIBUTING.md. Resolves #274
1 parent 512a6a2 commit e691d0f

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Contributing
2+
3+
## Local development
4+
5+
- The tests depend on having at least the following installed (possibly not
6+
a complete list)
7+
- git (A sufficiently newer version is required to run pre-push tests)
8+
- python
9+
- python3.3 (Required by a test which checks different python versions)
10+
- python3.4 (Required by a test which checks different python versions)
11+
- tox (or virtualenv)
12+
- ruby + gem
13+
14+
### Setting up an environemnt
15+
16+
This is useful for running specific tests. The easiest way to set this up
17+
is to run:
18+
19+
1. `tox -e venv`
20+
2. `. venv-pre_commit/bin/activate`
21+
22+
This will create and put you into a virtualenv which has an editable
23+
installation of pre-commit. Hack away! Running `pre-commit` will reflect
24+
your changes immediately.
25+
26+
### Running a specific test
27+
28+
Running a specific test with the environment activated is as easy as:
29+
`py.test tests -k test_the_name_of_your_test`
30+
31+
### Running all the tests
32+
33+
Running all the tests can be done by running `tox -e py27` (or your
34+
interpreter version of choice). These often take a long time and consume
35+
significant cpu while running the slower node / ruby integration tests.
36+
37+
Alternatively, with the environment activated you can run all of the tests
38+
using:
39+
`py.test tests`
40+
41+
To skip the slower ruby / node integration tests, you can set the environment
42+
variable `slowtests=false`.
43+
44+
### Setting up the hooks
45+
46+
With the environment activated simply run `pre-commit install`.
47+
48+
## Style
49+
50+
This repository follows pep8 (and enforces it with flake8). There are a few
51+
nitpicky things I also like that I'll outline below.
52+
53+
### Multi-line method invocation
54+
55+
Multiple line method invocation should look as follows
56+
57+
```python
58+
function_call(
59+
argument,
60+
argument,
61+
argument,
62+
)
63+
```
64+
65+
Some notable features:
66+
- The intial parenthese is at the end of the line
67+
- Parameters are indented one indentation level further than the function name
68+
- The last parameter contains a trailing comma (This helps make `git blame`
69+
more accurate and reduces merge conflicts when adding / removing parameters).
70+
71+
## Documentation
72+
73+
Documentation is hosted at http://pre-commit.com
74+
75+
This website is controlled through
76+
https://github.com/pre-commit/pre-commit.github.io
77+
78+
When adding a feature, please make a pull request to add yourself to the
79+
contributors list and add documentation to the website if applicable.

0 commit comments

Comments
 (0)