Skip to content

Commit 681a181

Browse files
authored
docs(NODE-3610): update contributing guidelines (#3000)
1 parent 808d7da commit 681a181

File tree

1 file changed

+47
-17
lines changed

1 file changed

+47
-17
lines changed

CONTRIBUTING.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ While it isn't required we have a minimum node version requirement (look in [pac
2222
### VSCode Setup
2323

2424
- Save the the workspace file [mongodbNodeDriver.code-workspace][workspace-file] next to where you have the driver cloned to and open this in VSCode.
25-
Double check that the `folders.path` at the top of the file's json is correct.
25+
Double check that the `folders.path` at the top of the file's json is correct.
2626

2727
- We recommended these extensions:
2828
- [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
@@ -62,25 +62,29 @@ If you just want to get formatting and linting working automatically use these s
6262
- You can prefix the npm test with a MONGODB_URI environment variable to point the tests to the correct deployment
6363
- `env MONGODB_URI=mongodb://localhost:27017 npm test`
6464
- If you are running against more than a standalone make sure your ulimit settings are in accordance with mongo's recommendations
65-
- Changing the settings on the latest versions of [macos can be tricky read here][macos-ulimt] (unless you know you need it you shouldn't have to do the complicated maxproc steps)
65+
- Changing the settings on the latest versions of macos can be tricky: [read here][macos-ulimt] (unless you know you need it you shouldn't have to do the complicated maxproc steps)
6666
- How can I run just one test?
6767
- To run a single test, use mocha's grep flag: `npm run test -- -g 'test name'`
6868
- If it's easier you can also isolate tests by adding `.only` Example: `it.only(‘cool test’, function() {})`
6969

7070
### Commit messages
7171

72-
Please follow the [Angular commit style][angular-commit-style].
72+
Please follow the [conventional commit style][conventional-commit-style].
7373
The format should look something like this (note the blank lines):
7474

7575
```txt
7676
<type>(<scope>): <subject>
7777
7878
<body>
79-
80-
NODE-XXXX
8179
```
8280

83-
If there is a relevant NODE ticket number it should be in the footer section of the Angular style commit.
81+
If there is a relevant NODE ticket number it should be referenced in the scope portion of the commit.
82+
83+
Note that a BREAKING CHANGE commit should include an exclamation mark after the scope, for example:
84+
85+
```text
86+
feat(NODE-xxxx)!: created new version api, removed support for old version
87+
```
8488

8589
This helps the team automate [HISTORY.md](HISTORY.md) generation.
8690
These are the commit types we make use of:
@@ -98,14 +102,11 @@ These are the commit types we make use of:
98102

99103
Below are some conventions that aren't enforced by any of our tooling but we nonetheless do our best to adhere to:
100104

101-
- **Ensure Promise usage is optional**
102-
- There is a measurable overhead to Promise usage vs callbacks.
103-
To support the broadest of driver usage scenarios we maintain an internal callback api while exposing a surface layer Promise API.
104105
- **Disallow `export default` syntax**
105106
- For our use case it is best if all imports / exports remain named.
106107
- **As of 4.0 all code in src is in Typescript**
107108
- Typescript provides a nice developer experience
108-
As a product of using TS we should be using es6 syntax features whenever possible.
109+
As a product of using TS we should be using es6 syntax features whenever possible.
109110
- **Errors**
110111
- Error messages should be sentence case, and have no periods at the end.
111112
- Use driver-specific error types where possible (not just `Error`, but classes that extend `MongoError`, e.g. `MongoNetworkError`)
@@ -116,18 +117,47 @@ Below are some conventions that aren't enforced by any of our tooling but we non
116117
wish to make, if applicable.
117118
1. Add any appropriate tests.
118119
1. Make your code or other changes.
119-
1. Review guidelines such as [How to write the perfect pull request][github-perfect-pr], thanks!
120-
121-
Take a look at [Github Flow][github-flow] for a more detailed explanation of this process.
122-
123-
[angular-commit-style]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits
124-
[changelog]: CHANGELOG.md
120+
1. Please adhere to the guidelines in [How to write the perfect pull request][github-perfect-pr], thanks!
121+
1. Please perform a self-review using the reviewer guidelines below prior to taking the PR out of draft state.
122+
123+
### Reviewer Guidelines
124+
125+
Reviewers should use the following questions to evaluate the implementation for correctness/completeness and ensure all housekeeping items have been addressed prior to merging the code.
126+
127+
- Correctness/completeness
128+
1. Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
129+
1. Does the code meet the acceptance criteria?
130+
- If there is an associated spec, does the code match the spec?
131+
1. Is the intention of the code captured in relevant tests?
132+
- Does the description of each test accurately represent the assertions?
133+
- For any test explicitly called out on the ticket as desirable to implement, was it implemented?
134+
- If there are prose spec tests, were they implemented?
135+
- If there are associated automated spec tests, were they all pulled in and are they all running and correctly interpreting the spec inputs?
136+
- Are any runner changes needed to process new input types?
137+
1. Could these changes impact any adjacent functionality?
138+
1. Are there any errors that might not be correctly caught or propagated?
139+
1. Is there anything that could impact performance?
140+
1. Are there any race conditions in the functional code or tests?
141+
1. Can you think of a better way to implement any of the functional code or tests? "Better" means any combination of:
142+
- more performant
143+
- better organized / easier to understand / clearer separation of concerns
144+
- easier to maintain (easier to change, harder to accidentally break)
145+
- Housekeeping
146+
1. Does the title and description of the PR reference the correct jira ticket and does it use the correct conventional commit type (e.g., fix, feat, test, breaking change etc)?
147+
- If the change is breaking, ensure there is an exclamation mark after the scope (e.g., "fix(NODE-xxx)!: \<description\>" )
148+
1. If there are new TODOs, has a related JIRA ticket been created?
149+
1. Are symbols correctly marked as internal or public?
150+
1. Do the Typescript types match expected runtime usage? Are there tests for new or updated types?
151+
1. Should any documentation be updated?
152+
- Has the relevant internal documentation been updated as part of the PR?
153+
- Have the external documentation requirements been captured in jira?
154+
155+
[conventional-commit-style]: https://www.conventionalcommits.org/en/v1.0.0/
125156
[code-of-conduct]: CODE_OF_CONDUCT.md
126157
[github-perfect-pr]: https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/
127158
[mdb-core-values]: https://www.mongodb.com/company/
128159
[mtools-install]: http://blog.rueckstiess.com/mtools/install.html
129160
[nvm-windows]: https://github.com/coreybutler/nvm-windows#installation--upgrades
130161
[nvm-unix]: https://github.com/nvm-sh/nvm#install--update-script
131162
[macos-ulimt]: https://wilsonmar.github.io/maximum-limits/
132-
[github-flow]: https://guides.github.com/introduction/flow/
133163
[workspace-file]: https://gist.githubusercontent.com/nbbeeken/d831a3801b4c463648c077b27da5057b/raw/8e986843e5e28019f7c0cebe5c6fa72407bf8afb/node-mongodb-native.code-workspace

0 commit comments

Comments
 (0)