Skip to content

doc: adding "rules of thumb"#12744

Closed
refack wants to merge 9 commits into
masterfrom
refack-patch-2
Closed

doc: adding "rules of thumb"#12744
refack wants to merge 9 commits into
masterfrom
refack-patch-2

Conversation

@refack
Copy link
Copy Markdown
Contributor

@refack refack commented Apr 29, 2017

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:

  1. A significant amount of the first-time contributors don't look at this document at all. So is this the best place to put this?
  2. Are some of these not just rules of thumb but rather requirements that are better moved to appropriate places of the document.

Checklist
Affected core subsystem(s)

doc

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Apr 29, 2017
Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Contributor

@vsemozhetbyt vsemozhetbyt Apr 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but -> bug

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we should set up rules like this one, and instead keep trying to use good judgement. I can’t really imagine a “reasonable size” defined for all PRs, it’s really a case-by-case thing. (e.g. #11883 and #11975 are huge PRs and that’s completely reasonable in my eyes).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 )

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into the commit message section, imho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good!
Also some PRs don't follow the rules and don't include the original commit messages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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).
I'll make it more explicit, to things like

  • renaming variables
  • adding/removing white spaces
  • reordering lines
    Anything else?

@addaleax
Copy link
Copy Markdown
Member

(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?)

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically comes down to “run make test/make lint” before submitting a PR, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be aware (also changed title) so less surprises when actually doing make lint

@refack
Copy link
Copy Markdown
Contributor Author

refack commented Apr 29, 2017

(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?)

Sorry, apparently it happens when I use the (limited) web interface.

@refack refack self-assigned this Apr 29, 2017
@refack refack added the discuss Issues opened for discussions and feedbacks. label Apr 29, 2017
aqrln
aqrln previously requested changes Apr 29, 2017
Copy link
Copy Markdown
Contributor

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also format the commit message according to the commit guidelines, please?
(s/adding/add).

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/preferance/preference

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe something like "we maintain multiple release lines" would be more clear?

Comment thread CONTRIBUTING.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@refack
Copy link
Copy Markdown
Contributor Author

refack commented Apr 29, 2017

Addressed comments. PTAL.

@aqrln aqrln dismissed their stale review April 29, 2017 18:33

Requested changes have been made.

Copy link
Copy Markdown
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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…

Comment thread CONTRIBUTING.md Outdated
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this should go into the section describing commit messages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.
I ment the contributor should know they will need to explicitly provide their motivation.
P.S. adding to section about commit message

Comment thread CONTRIBUTING.md Outdated
### 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
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, PTAL

Comment thread CONTRIBUTING.md Outdated
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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

Comment thread CONTRIBUTING.md Outdated
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: self-contained

Comment thread CONTRIBUTING.md Outdated
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“keep you in line”?

Comment thread CONTRIBUTING.md Outdated
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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: adjustments

@aqrln
Copy link
Copy Markdown
Contributor

aqrln commented Apr 29, 2017

@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.

  1. Apparently, a significant amount of the first-time contributors either don't look at this document at all, however prominent it is and despite the link being shown when they open a PR, or just skim through it without really understanding it. Just look at all those 100 characters length capitalized commit messages in PRs with the "commit message follows commit guidelines" item being marked with a tick. I'd really love to see ways and ideas to make this information more accessible, not to overwhelm people with another wall of text.

  2. I don't really think all of these points can be qualified as "rules of thumb". Some of them are arguable and really depend on the situation and some of them are not just rules of thumb but rather requirements that are better moved to appropriate places of the document, if there are ones. I don't think there's a section covering the code style, though, and I'd rather create it somewhere and populate it with information about the Google C++ Code Style, cpplint, our custom ESLint rules and how to run the linter, etc.

@refack
Copy link
Copy Markdown
Contributor Author

refack commented Apr 29, 2017

@aqrln I assumed so. Let's let this PR stew (as PRs do). Anyway I hope this PR is a good start
I'll add you reservations as invitation for ideas in the first comment.

P.S. This is actually a fix to #12636

@Trott
Copy link
Copy Markdown
Member

Trott commented Apr 29, 2017

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.

@refack
Copy link
Copy Markdown
Contribu