How do I review an entire codebase on github?

2k views Asked by At

I would like to review all of the code in a single branch of a git repo on GitHub. (I am a professor, and the code is part of a student's thesis.) Any single commit affects only a small portion of the code. How can I perform a review that allows me to make per-line comments on all of the code from any commit?

I believe this question is related to How can I make a github PR requesting review of entire files?, which was never answered.

1

There are 1 answers

4
Peter Badida On

Navigate to the repo, then select the branch (for example) with the dropdown:

Then after the switch you can choose to Compare or Pull request which will display again at the top of the repo file list - in both you can compare, but PR option can open a "ticket" for merging - the request to pull from a branch.

Or you can click on the commits link:

Then simply open the commit (if you check from Compare or Pull request and within the diff itself you can hover over specific lines. Once the cursor hovers a + sign appears. You can comment and the author will get a notification via email.

Note: while reviewing the whole codebase is possible through commits, make sure you know what state you're reviewing because the commit comment won't simply disappear as if in a Pull request. It'll stay there, so you'll need to somehow make a note that it's resolved (unless GitHub added a new feature I'm not aware of) and check again e.g. in master branch whether the part of the file has been resolved.

It's quite a cumbersome process though, so it'll be okay probably just for smaller sections of the codebase or for school projects as it doesn't scale well due to the comments remaining in place and required manual task of checking whether the review comments have been taken into consideration / implemented.

For scaling you can use perhaps a more intrusive, but more scalable technique such as creating a new empty repo (or a new branch, then while :;do git reset HEAD~ --hard;done up to initial commit) and adding relevant file(s) grouped by a feature they represent (and hopefully a test, because it'll definitely break the codebase for a while) and then start opening PRs for each, review, let GitHub remove the comments and merge when the code is of a sufficient quality. Still though, it's a workaround when trying to treat git as a simple folder structure, which it is not - rather a graph/tree.

Alternatively you can create a task list for your student/colleague/peer where s/he can mark the tasks as completed or open a completely new issue with relevant lines referenced by a permalink.