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