Skip to content

Add code comments in file (blob) view

Understanding and reviewing code is something that happens all the time, not only during a merge request. It should be easy to ask a question or leave feedback on any line in any file. Currently this is possible, but hard to use because it is hidden in the Commit view (<project>/commit/<sha>). It would be much easier to access in the Blob view (<project>/blob/<object>/<filename>). This would increase the visibility of comments when browsing a project and make it much easier to leave a comment.

Further information / use cases

Audit – audits by external parties are typically done periodically, not continuously. Where questions and concerns arise it should be possible to leave a comment on the code quickly and easily, probably referencing the an issue about the audit.

New engineer – when a new engineer joins the team, or an engineer begins to look at code outside their area of familiarity, it would be convenient to ask a question directly on the code. This also benefits other developers who have questions. If a discussion on the code results in an agreement that improvements should be made, it should be easy to create an issue from the discussion.

Proposal

Screenshots of comments in commit view:

Adding a comment New changes after a comment More comments
Screen_Shot_2016-11-30_at_16.12.06 Screen_Shot_2016-11-30_at_16.10.55 Screen_Shot_2016-11-30_at_16.08.31

Viewing comments

Comments added to a line on a commit should be visible in the blob view, so that they can be accessed easily.

Adding comments

Starting a discussion on a line by adding a comment, should start the discussion on the current commit.

Creating a discussion should notify the users who are mentioned, project maintainers and code owners.

Resolving comments

Some discussions may not require any action. It should be possible to resolve these discussions to dismiss and hide the discussion.

Merge request commit comments

It may be useful to allow comments added to a commit to be accessible in the merge request too so that comments don't end up split between two locations depending on the link the user is sent for review.

Links / references

Original description

Gitlab allows to enter code comments in "commit" view (i. e. project -> commits -> commit -> lists all files; user can enter line comments).

That is nice, but not everybody wants to review commit-by-commit. Often people want to comment the "current" status, so they navigate vioa "files" (not on "comments"). The files are shown, and line numbers highlight when mouse hovers over the line, but no comments can be entered.

It would be great if Gitlab also allows entering code comments in "file" view (i. e. project -> files -> file; user can enter line comments), too.

*This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.*
Edited by 🤖 GitLab Bot 🤖