-
Notifications
You must be signed in to change notification settings - Fork 0
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
Discussion: Suggestions on best practices to include in PR chapter #48
Comments
Very nice! Very similar to what I was thinking to have in the chapter, and how we do things in Seedcase 🥳🥳 |
Very nice! (and hello, @joelostblom ! 🥳 ) The points under For the PR author made me think about where it's best practice to add what information (in issues vs PR descriptions vs commit messages):
What are your thoughts on this, @lwjohnst86 and @joelostblom ? (Neither of those points are fully fleshed thoughts btw, just the thoughts that popped up while I was reading the issue ☺ ) |
Hello @signekb 👋 Nice to e-meet you! Thanks for sharing your thoughts on this, here are a few comment on what you wrote:
I agree that for that particular PR, the "Problem" and "Reproduce" headings could have gone in an issue. I believe the reason they went in the PR was that they captured what was happening in a few different issues with a general description (which could have been a third issue instead, closing the other two).
Yes, I think (but haven't confirmed) that this message is likely from a git, but non-github (or at least non-PR based) flow where I tend to see more elaborate messages. As you say, with squash merge, then PR descriptions go into the commits and make the difference between these two flows less apparent which I think is convenient.
I understand that the long descriptions for these PRs can be overwhelming and it would make sense to include examples of a simpler PR as well. The PRs I listed were either touching something deep within the code base (as for "Remove deep validation...") or added a large new feature (as for "Integrate VegaFusion into JupyterChart"). It could have been useful to break those up into smaller PRs with shorter descriptions, I don't think it was easily possible for either of those as they both represent "one unit of change" in some sense. Given that restriction, it was incredibly useful to have these long descriptions when reviewing because it allowed me to understand the PR author's thought process and understand better why they chose to solve the problem this way, both of which would have been hard to recontstruct from the code alone or a shorter message. But again, all for adding in simpler PR examples too. |
@joelostblom You too! 👋 Again: thanks for you inputs! They're super useful for when we start going into the specific sessions/chapters! 🎉” |
@lwjohnst86 at long last I managed to clean up my thoughts somewhat and paste them into this issue. There are still several resources I would want to read through, but I think they would only introduce tweaks and no fundamental change to this workflow. This more on the "best practices" side of things than the mechanics, which is something I think is really important and does not come naturally just because someone knows how to mechanically go through the steps of creating a PR or leaving a review. Let me know what you think!
PR best practices
Motivation
Why bother learning how to write proper PRs? A few excerpts from other articles that I think cover the most important points and we could summarize:
For the PR author
can lead to wasted time and effort,
either via substantial re-writes,
or even that the PR is rejected.
(TODO Link to something about how to write clear code?)
If there are changes in visual output,
including screenshots can be helpful.
but should not introduce multiple unrelated changes.
you shouldn't also create a new visualization in another part of the codebase
just because you happened to think about it around the same time.
Only if these changes are semantically/logically connected
should they go in the same PR.
and also to understand the changes.
and reduces the chances of merge conflicts.
It also often means that less time is wasted
reminding yourself what this PR is about
as the changes are fresh in the mind of both the author and the reviewer,
naturally makes them shorter.
git add -p
is helpful for thisand also prevents accidentally committing more than needed
(e.g. committing entire files when there are only some lines that changed).
It allows allows you to review your changes.
git commit
to bring up the editorinstead of
git commit -m 'message'
can encourage the writing of more elaborative messages.
Together with git's "verbose mode",
this can also serve as a review of the changes
(the "patch" shows in the editor).
should follow the
conventional commit
guidelines.That means if you are adding the PR code via merging/rebasing,
then all commits should be formatted like this.
If you are squashing commits,
then only the PR title needs to follow this style.
as this gives a clearer history on main
that still saves all the individual commits on the feature branch
if the changes made in a PR are needed to be bisected further.
and request a new review (don't silently update the code).
when the reviewer finds issues without your code
and asks you to change it.
if your bugs made it into production.
talk about the code, not the person reviewing it
(avoid using "you" as much as possible).
Your reviewer might be incorrect
or you might be misunderstanding something.
The only way to find out is through effective communication.
Instead of guessing what the reviewer means,
ask for clarification and come to an agreement before making changes.
For the PR reviewer
suggest that the code is rewritten in a clearer manner
or an explanatory comment is added.
PRs go stale if they sit for days or weeks.
This means that the author and the reviewer will lose context
and the team will move forward slowly.
If you don't have time to review quickly,
ask you management to re-prioritize your time to benefit the organization.
Resources
The text was updated successfully, but these errors were encountered: