doc: adding "rules of thumb"#12744
Conversation
There was a problem hiding this comment.
There was a problem hiding this comment.
I'll reword, but IMHO something should be put in writing. For example @vsemozhetbyt made #12735 which is good, but very hard to review ( @vsemozhetbyt ment with love )
There was a problem hiding this comment.
This should go into the commit message section, imho.
There was a problem hiding this comment.
Ok, good!
Also some PRs don't follow the rules and don't include the original commit messages.
There was a problem hiding this comment.
No need to make the headings bold, we don’t do that elsewhere either. If you want these to be headings, then go with Markdown’s built-in support for, well, headings ;)
There was a problem hiding this comment.
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.
"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.
What I meant was changes that are just personal style changes (or a result of some automatic tool).
I'll make it more explicit, to things like
- renaming variables
- adding/removing white spaces
- reordering lines
Anything else?
|
(By the way: I assume it’s by accident, but you keep opening PRs from the nodejs/node repo instead of your fork … we don’t do that except for releases branches, can you try to make sure you open PRs from your fork for the future?) |
There was a problem hiding this comment.
This basically comes down to “run make test/make lint” before submitting a PR, right?
There was a problem hiding this comment.
Be aware (also changed title) so less surprises when actually doing make lint
Sorry, apparently it happens when I use the (limited) web interface. |
aqrln
left a comment
There was a problem hiding this comment.
Can you also format the commit message according to the commit guidelines, please?
(s/adding/add).
There was a problem hiding this comment.
I believe something like "we maintain multiple release lines" would be more clear?
There was a problem hiding this comment.
This will turn into duplicate phrases when rendered. Making "our own custom rules" a single link instead of "our own rules" text followed by the "custom rules" link would be better.
|
Addressed comments. PTAL. |
addaleax
left a comment
There was a problem hiding this comment.
I still mostly think point 1 should be moved into the section that’s actually about commit messages, and I’m not sure points 2 and 3 need to be described in that much detail…
| 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.
I still think this should go into the section describing commit messages
There was a problem hiding this comment.
Do you mean having it there as well?
Since this is a general section, IMHO people should have this is mind when thinking about a contribution.
There was a problem hiding this comment.
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.
Sometimes I just like to churn 😄, reindent, reorder lines, rethink names etc... But I keep it to my code.
I ment the contributor should know they will need to explicitly provide their motivation.
P.S. adding to section about commit message
| ### 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 |
There was a problem hiding this comment.
It might be helpful to use full sentences here
| 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.
ditto for using full sentences, that will at least help everyone who’s not a native English speaker
| 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. | ||
| 3. #### Keep your change-set self contained but at a reasonable size |
| 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) | ||
| should keep you in line. |
| 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) |
|
@refack I dismissed that red cross sign, but not explicitly approving, I'm +0 on this. Generally it looks good but I have several concerns that overweight it.
|
|
I'd rather see less text, not more, in the CONTRIBUTING.md. I'd prefer a PR that removes everything that isn't absolutely essential. If we're going to provide helpful hints like this, I'd prefer they be below the instructions for forking etc., rather than at the top of the doc. I think most people will be discouraged by a wall of a text and won't read it. If we want to include this content, it should be one sentence per point with links to other docs if further explanation should be required. |
Discussion moved to #12791
Fixes: #12636
[edit]
As I understand the term "rules of thumb", they are guidelines one should have in mind and try to adhere to, but are not necessarily hard requirements. Our requirements should be stated in the other parts of the document.
[/edit]
My suggestion for a few "rules of thumb" for code contributions.
These are obviously my personal opinion, so this PR welcomes edit and suggestions. I do think that we should put some loose guidelines in writing.
The following made me think of this, and are not critique!
Ref: #12603 - motivation
Ref: #12735 - size
Open questions:
Checklist
Affected core subsystem(s)
doc