-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: adding "rules of thumb" #12744
doc: adding "rules of thumb" #12744
Changes from 1 commit
9a79fe6
953c7e0
9ab59c1
1691471
edc0b43
011263e
3a9ee5b
fccb06a
3fd0eb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,34 @@ works. | |
|
||
This document will guide you through the contribution process. | ||
|
||
### Rules of thumb | ||
|
||
1. #### Provide motivation for the change | ||
Why will this change make the code better; does it fix a bug, is it a new | ||
feature, etc. This should be in the commit messages as well as in the PR | ||
description. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still think this should go into the section describing commit messages There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean having it there as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I don’t think I’ve ever seen somebody make a PR without having a reason to do so 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sometimes I just like to churn 😄, reindent, reorder lines, rethink names etc... But I keep it to my code. |
||
2. #### Don't make _unnecessary_ code changes | ||
Things that are changed because of personal preference or style, like: | ||
renaming of variables or functions, adding or removing white spaces, | ||
reordering lines or whole code blocks. These sort of changes should have | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto for using full sentences, that will at least help everyone who’s not a native English speaker |
||
a good reason since they cause unnecessary ["code churn"](https://blog.gitprime.com/why-code-churn-matters). | ||
As part of the project's strategy we maintain multiple release lines, code | ||
churn might hinder back-porting changes to other lines. Also when you | ||
change a line, your name will come up in `git blame` and might hide the | ||
previous writer of the code. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn’t really sound like a “rule of thumb” to me – It doesn’t really tell contributors anything about what they should or should not do, does it? (Also: “churn” might be a bit too much of a jargon-y term, I could imagine a lot of people don’t know what that means) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "churn" is also quite subjective. At the code and learn events, we intentionally encourage participants to focus on very small changes that end up leading to quite a bit of churn individually. We have also become much better at very quickly reviewing and landing smaller changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I meant was changes that are just personal style changes (or a result of some automatic tool).
|
||
3. #### Keep your change-set self contained but at a reasonable size | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: |
||
Use your good judgment when making a big change. If you can't think of a | ||
good reason but need to make a very big PR, try to break it into smaller | ||
pieces (still as self-contained as possible), and cross-reference them. | ||
You can also mark some of them as `blocked` pending the others. | ||
4. #### Be aware of our style rules | ||
As part of acceptance of a PR the changes must pass our linters. For C++ we | ||
use Google's cpplint (with some ajustments) so following their [style-guide](https://github.com/google/styleguide) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo: adjustments |
||
should keep you in line. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. “keep you in line”? |
||
For JS we use this [ruleset](https://github.com/nodejs/node/blob/master/.eslintrc.yaml) | ||
for ESLint plus some of [our own custom rules](https://github.com/nodejs/node/tree/master/tools/eslint-rules) | ||
For markdown we have a [style guide](https://github.com/nodejs/node/blob/master/doc/STYLE_GUIDE.md) | ||
|
||
### Step 1: Fork | ||
|
||
Fork the project [on GitHub](https://github.com/nodejs/node) and check out your | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful to use full sentences here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, PTAL