Working on v4.2.3
[platform/upstream/nodejs.git] / CONTRIBUTING.md
1 # Contributing to Node.js
2
3 ## Issue Contributions
4
5 When opening new issues or commenting on existing issues on this repository
6 please make sure discussions are related to concrete technical issues with the
7 Node.js software.
8
9 For general help using Node.js, please file an issue at the
10 [Node.js help repository](https://github.com/nodejs/help/issues).
11
12 Discussion of non-technical topics including subjects like intellectual
13 property, trademark and high level project questions should move to the
14 [node-forward discussions repository](https://github.com/node-forward/discussions)
15 instead.
16
17 ## Code Contributions
18
19 The Node.js project has an open governance model and welcomes new contributors.
20 Individuals making significant and valuable contributions are made
21 _Collaborators_ and given commit-access to the project. See the
22 [GOVERNANCE.md](./GOVERNANCE.md) document for more information about how this
23 works.
24
25 This document will guide you through the contribution process.
26
27 ### Step 1: Fork
28
29 Fork the project [on GitHub](https://github.com/nodejs/node) and check out your
30 copy locally.
31
32 ```text
33 $ git clone git@github.com:username/node.git
34 $ cd node
35 $ git remote add upstream git://github.com/nodejs/node.git
36 ```
37
38 #### Which branch?
39
40 For developing new features and bug fixes, the `master` branch should be pulled
41 and built upon.
42
43 #### Respect the stability index
44
45 The rules for the master branch are less strict; consult the
46 [stability index](./doc/api/documentation.markdown#stability-index) for details.
47
48 In a nutshell, modules are at varying levels of API stability.  Bug fixes are
49 always welcome but API or behavioral changes to modules at stability level 3
50 (Locked) are off-limits.
51
52 #### Dependencies
53
54 Node.js has several bundled dependencies in the *deps/* and the *tools/*
55 directories that are not part of the project proper.  Any changes to files
56 in those directories or its subdirectories should be sent to their respective
57 projects.  Do not send your patch to us, we cannot accept it.
58
59 In case of doubt, open an issue in the
60 [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the
61 [project Collaborators](https://github.com/nodejs/node/#current-project-team-members).
62 ([IRC](http://webchat.freenode.net/?channels=io.js) is often the best medium.) Especially do so if you plan to work on something big.  Nothing is more
63 frustrating than seeing your hard work go to waste because your vision
64 does not align with the project team.
65
66
67 ### Step 2: Branch
68
69 Create a feature branch and start hacking:
70
71 ```text
72 $ git checkout -b my-feature-branch -t origin/master
73 ```
74
75 ### Step 3: Commit
76
77 Make sure git knows your name and email address:
78
79 ```text
80 $ git config --global user.name "J. Random User"
81 $ git config --global user.email "j.random.user@example.com"
82 ```
83
84 Writing good commit logs is important.  A commit log should describe what
85 changed and why.  Follow these guidelines when writing one:
86
87 1. The first line should be 50 characters or less and contain a short
88    description of the change prefixed with the name of the changed
89    subsystem (e.g. "net: add localAddress and localPort to Socket").
90 2. Keep the second line blank.
91 3. Wrap all other lines at 72 columns.
92
93 A good commit log can look something like this:
94
95 ```
96 subsystem: explaining the commit in one line
97
98 Body of commit message is a few lines of text, explaining things
99 in more detail, possibly giving some background about the issue
100 being fixed, etc. etc.
101
102 The body of the commit message can be several paragraphs, and
103 please do proper word-wrap and keep columns shorter than about
104 72 characters or so. That way `git log` will show things
105 nicely even when it is indented.
106 ```
107
108 The header line should be meaningful; it is what other people see when they
109 run `git shortlog` or `git log --oneline`.
110
111 Check the output of `git log --oneline files_that_you_changed` to find out
112 what subsystem (or subsystems) your changes touch.
113
114
115 ### Step 4: Rebase
116
117 Use `git rebase` (not `git merge`) to sync your work from time to time.
118
119 ```text
120 $ git fetch upstream
121 $ git rebase upstream/master
122 ```
123
124
125 ### Step 5: Test
126
127 Bug fixes and features **should come with tests**.  Add your tests in the
128 test/parallel/ directory.  Look at other tests to see how they should be
129 structured (license boilerplate, common includes, etc.).
130
131 ```text
132 $ ./configure && make -j8 test
133 ```
134
135 Make sure the linter is happy and that all tests pass.  Please, do not submit
136 patches that fail either check.
137
138 If you are updating tests and just want to run a single test to check it, you
139 can use this syntax to run it exactly as the test harness would:
140
141 ```text
142 $ python tools/test.py -v --mode=release parallel/test-stream2-transform
143 ```
144
145 You can run tests directly with node:
146
147 ```text
148 $ ./node ./test/parallel/test-stream2-transform.js
149 ```
150
151 Remember to recompile with `make -j8` in between test runs if you change
152 core modules.
153
154 ### Step 6: Push
155
156 ```text
157 $ git push origin my-feature-branch
158 ```
159
160 Go to https://github.com/yourusername/node and select your feature branch.
161 Click the 'Pull Request' button and fill out the form.
162
163 Pull requests are usually reviewed within a few days.  If there are comments
164 to address, apply your changes in a separate commit and push that to your
165 feature branch.  Post a comment in the pull request afterwards; GitHub does
166 not send out notifications when you add commits.
167
168
169 ## Developer's Certificate of Origin 1.0
170
171 By making a contribution to this project, I certify that:
172
173 * (a) The contribution was created in whole or in part by me and I
174   have the right to submit it under the open source license indicated
175   in the file; or
176 * (b) The contribution is based upon previous work that, to the best
177   of my knowledge, is covered under an appropriate open source license
178   and I have the right under that license to submit that work with
179   modifications, whether created in whole or in part by me, under the
180   same open source license (unless I am permitted to submit under a
181   different license), as indicated in the file; or
182 * (c) The contribution was provided directly to me by some other
183   person who certified (a), (b) or (c) and I have not modified it.
184
185
186 ## Code of Conduct
187
188 This Code of Conduct is adapted from [Rust's wonderful
189 CoC](http://www.rust-lang.org/conduct.html).
190
191 * We are committed to providing a friendly, safe and welcoming
192   environment for all, regardless of gender, sexual orientation,
193   disability, ethnicity, religion, or similar personal characteristic.
194 * Please avoid using overtly sexual nicknames or other nicknames that
195   might detract from a friendly, safe and welcoming environment for
196   all.
197 * Please be kind and courteous. There's no need to be mean or rude.
198 * Respect that people have differences of opinion and that every
199   design or implementation choice carries a trade-off and numerous
200   costs. There is seldom a right answer.
201 * Please keep unstructured critique to a minimum. If you have solid
202   ideas you want to experiment with, make a fork and see how it works.
203 * We will exclude you from interaction if you insult, demean or harass
204   anyone.  That is not welcome behavior. We interpret the term
205   "harassment" as including the definition in the [Citizen Code of
206   Conduct](http://citizencodeofconduct.org/); if you have any lack of
207   clarity about what might be included in that concept, please read
208   their definition. In particular, we don't tolerate behavior that
209   excludes people in socially marginalized groups.
210 * Private harassment is also unacceptable. No matter who you are, if
211   you feel you have been or are being harassed or made uncomfortable
212   by a community member, please contact one of the channel ops or any
213   of the TC members immediately with a capture (log, photo, email) of
214   the harassment if possible.  Whether you're a regular contributor or
215   a newcomer, we care about making this community a safe place for you
216   and we've got your back.
217 * Likewise any spamming, trolling, flaming, baiting or other
218   attention-stealing behavior is not welcome.
219 * Avoid the use of personal pronouns in code comments or
220   documentation. There is no need to address persons when explaining
221   code (e.g. "When the developer")