Skip to content
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

Add "code suggestion" recommendation to review docs #920

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion content/en/contribute/code/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,31 @@ A good workflow would be to work locally, pushing to a remote branch as you make

The author and reviewer should use this [guide to code reviewing](https://google.github.io/eng-practices/review/developer/).

#### Suggestions

When doing a code review aim to be extremely clear. This helps things move quickly and avoids lost time in misunderstandings. One especially useful GitHub feature for doing this is suggesting a change. Consider the following example code:
Copy link
Member

Choose a reason for hiding this comment

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

Should we link the GitHub related documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we link the GitHub related documentation?

Yes! Although, I couldn't find a GitHub source for guidance on this feature specifically. I found a couple pages when it went into beta in 2018 and more general stuff (like the link you mentioned), but I could not find any page from GitHub on this feature. Have you seen anything better @andrablaj?

Copy link
Member

@andrablaj andrablaj Dec 20, 2022

Choose a reason for hiding this comment

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

Step 6 of the link I shared is about the suggestion feature. I didn't find anything more detailed though.

Copy link
Member

Choose a reason for hiding this comment

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

The PR can be merged without applying this suggestion, as your documentation is more detailed than the GitHub guide.


```javascript
contacts.map( (c) => { return c.id });
```

The function body can be abbreviated. In a review you can leave a comment asking for the change, which would likely involve writing up a comment trying to have the author change it to the following:

```javascript
contacts.map( c => c.id);
```
That means leaving a comment, having the author read and understand it, and then making and pushing up a change, hopefully matching your review expectations.

To be clear and save all that back-and-forth though, you can make a code suggestion directly in your review, which will let the author simply click a button to accept the change (and have it automatically applied as a commit by GitHub).

![GitHub review suggest change](gh-review-suggestion.png)

#### Timeliness

Timely code reviews are important to getting improvements into the hands of users faster and allowing developers to stay focused on the task at hand and see it through to production.

Code reviews should be completed within 24 hours of assignment (excluding weekends and holidays). In some cases, a code review may not be possible if a larger discussion needs to be had for design choices or solution objectives, but even in cases like those, some feedback is still to be expected within 24 hours.


### Updating The Issue With What You Actually Did

Add [labels](https://github.com/medic/cht-core/labels) to the GitHub issue as needed. At this stage, the two to look out for are:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.