net: don't throw on net.Server.close()
[platform/upstream/nodejs.git] / CONTRIBUTING.md
1 # CONTRIBUTING
2
3 The node.js project welcomes new contributors.  This document will guide you
4 through the process.
5
6
7 ### FORK
8
9 Fork the project [on GitHub](https://github.com/joyent/node) and check out
10 your copy.
11
12 ```
13 $ git clone git@github.com:username/node.git
14 $ cd node
15 $ git remote add upstream git://github.com/joyent/node.git
16 ```
17
18 Now decide if you want your feature or bug fix to go into the master branch
19 or the stable branch.  As a rule of thumb, bug fixes go into the stable branch
20 while new features go into the master branch.
21
22 The stable branch is effectively frozen; patches that change the node.js
23 API/ABI or affect the run-time behavior of applications get rejected.
24
25 The rules for the master branch are less strict; consult the
26 [stability index page][] for details.
27
28 In a nutshell, modules are at varying levels of API stability.  Bug fixes are
29 always welcome but API or behavioral  changes to modules at stability level 3
30 and up are off-limits.
31
32 Node.js has several bundled dependencies in the deps/ and the tools/
33 directories that are not part of the project proper.  Any changes to files
34 in those directories or its subdirectories should be sent to their respective
35 projects.  Do not send your patch to us, we cannot accept it.
36
37 In case of doubt, open an issue in the [issue tracker][], post your question
38 to the [node.js mailing list][] or contact one of the [project maintainers][]
39 on [IRC][].
40
41 Especially do so if you plan to work on something big.  Nothing is more
42 frustrating than seeing your hard work go to waste because your vision
43 does not align with that of a project maintainer.
44
45
46 ### BRANCH
47
48 Okay, so you have decided on the proper branch.  Create a feature branch
49 and start hacking:
50
51 ```
52 $ git checkout -b my-feature-branch -t origin/v0.10
53 ```
54
55 (Where v0.10 is the latest stable branch as of this writing.)
56
57
58 ### COMMIT
59
60 Make sure git knows your name and email address:
61
62 ```
63 $ git config --global user.name "J. Random User"
64 $ git config --global user.email "j.random.user@example.com"
65 ```
66
67 Writing good commit logs is important.  A commit log should describe what
68 changed and why.  Follow these guidelines when writing one:
69
70 1. The first line should be 50 characters or less and contain a short
71    description of the change prefixed with the name of the changed
72    subsystem (e.g. "net: add localAddress and localPort to Socket").
73 2. Keep the second line blank.
74 3. Wrap all other lines at 72 columns.
75
76 A good commit log looks like this:
77
78 ```
79 subsystem: explaining the commit in one line
80
81 Body of commit message is a few lines of text, explaining things
82 in more detail, possibly giving some background about the issue
83 being fixed, etc etc.
84
85 The body of the commit message can be several paragraphs, and
86 please do proper word-wrap and keep columns shorter than about
87 72 characters or so. That way `git log` will show things
88 nicely even when it is indented.
89 ```
90
91 The header line should be meaningful; it is what other people see when they
92 run `git shortlog` or `git log --oneline`.
93
94 Check the output of `git log --oneline files_that_you_changed` to find out
95 what subsystem (or subsystems) your changes touch.
96
97
98 ### REBASE
99
100 Use `git rebase` (not `git merge`) to sync your work from time to time.
101
102 ```
103 $ git fetch upstream
104 $ git rebase upstream/v0.10  # or upstream/master
105 ```
106
107
108 ### TEST
109
110 Bug fixes and features should come with tests.  Add your tests in the
111 test/simple/ directory.  Look at other tests to see how they should be
112 structured (license boilerplate, common includes, etc.).
113
114 ```
115 $ make jslint test
116 ```
117
118 Make sure the linter is happy and that all tests pass.  Please, do not submit
119 patches that fail either check.
120
121 If you are updating tests and just want to run a single test to check it, you
122 can use this syntax to run it exactly as the test harness would:
123
124 ```
125 python tools/test.py -v --mode=release simple/test-stream2-transform
126 ```
127
128 You can run tests directly with node:
129
130 ```
131 node ./test/simple/test-streams2-transform.js
132 ```
133
134
135 ### PUSH
136
137 ```
138 $ git push origin my-feature-branch
139 ```
140
141 Go to https://github.com/username/node and select your feature branch.  Click
142 the 'Pull Request' button and fill out the form.
143
144 Pull requests are usually reviewed within a few days.  If there are comments
145 to address, apply your changes in a separate commit and push that to your
146 feature branch.  Post a comment in the pull request afterwards; GitHub does
147 not send out notifications when you add commits.
148
149
150 ### CONTRIBUTOR LICENSE AGREEMENT
151
152 Please visit http://nodejs.org/cla.html and sign the Contributor License
153 Agreement.  You only need to do that once.
154
155
156 [stability index page]: https://github.com/joyent/node/blob/master/doc/api/documentation.markdown
157 [issue tracker]: https://github.com/joyent/node/issues
158 [node.js mailing list]: http://groups.google.com/group/nodejs
159 [IRC]: http://webchat.freenode.net/?channels=node.js
160 [project maintainers]: https://github.com/joyent/node/wiki/Project-Organization