Sometimes it is necessary to leave feedback about all the source code in the repository, for example, when accepting code for support from other developers or when connecting to a new project.
The code review processes in Github and its analogs are built around the changes being made, but in our case, comments need to be given to the state of the entire code at the time of commenting.
How to do this using git itself: fix the state in the review branch, then leave your comments in the merge request for this branch.
In general, the essence of the method has already been stated, below are just a few details.
The task
Imagine the situation: someone gave you a code repository and ask for your opinion on it. Usually, in such cases, comments are made in a separate document/task/page in confluence, etc., which is not very convenient:
- Comments may become outdated already during the writing process because development goes on.
- It is difficult to refer to individual sections of the code; references like doubtful/bar.js:4 are simply inconvenient because of constantly switching between the document and the code.
- In isolation from the source code, the document most likely will be lost.
Code review of the system method
So, we need to do the following: fix the state in the branch for the review, then leave your comments in the merge request for this branch.
Using the example of the repository prepared for the note https://github.com/oktend/system-review-example, we will do these steps:
- Find the state in the repository for the review (at the time of the review it was the last commit in dev):
- https://github.com/oktend/system-review-example/commit/0514531a35edf19e7032eb49f45a98d019f83efe
- Branch from the selected state a branch for our system review, for example, “system-review/1march2020-goodman”:
- https://github.com/oktend/system-review-example/tree/system-review/1march2020-goodman
- Create another branch from the newly created branch, in which we will collect comments, for example, “1march2020-goodman-issues”:
- https://github.com/oktend/system-review-example/tree/system-review/1march2020-goodman-issues
- Bring the comments to this thread in a convenient way, both directly in the code and in individual documents.
- Create a merge request (may be called a pull request) to the review branch “system-review/1march2020-goodman-issues” -> “system-review/1march2020-goodman”:
- https://github.com/oktend/system-review-example/pull/1/files Now our branches look something like this:
https://github.com/oktend/system-review-example/network
The result
In the created merge request, you can see all the comments collected during the review, even discuss them.
The state for which comments were made will be fixed until the branch is explicitly deleted.
Comments can be made in isolation from the code:
https://github.com/oktend/system-review-example/blob/c80b03710059b235347ec781bf08dca9c0e68f7d/review-1march2020-goodman.md
so in the context of the code:
https://github.com/oktend/system-review-example/blob/c80b03710059b235347ec781bf08dca9c0e68f7d/foo.js
Comments can be viewed in the GitHub web interface (or equivalents), in the IDE, or using git itself.
It will be possible to return to the review in the future, keeping the comments and the context in which they were put forward.

Top comments (0)