Comment on any line in a changed file in merge request diff
Changing one line of code can easily impact other lines of code, where a function is used, or where an expected behavior is violated. Although it is possible to reference these in a comment on the changed line in many instances it makes more sense to leave the comment on the place that should be changed, but has not yet been changed. This is not possible in GitLab.
Further details
A customer writes:
Currently comments are limited to lines that have been added/removed, but often we find ourselves leaving comments like:
On line xxx below, please change ...
Where it would be much less confusing (especially if those lines are hidden behind the "..." expander) to just comment on the line that needs to be changed. This is quite common during refactoring, where a user might modify or remove something in one place that has ramifications to code that wasn't modified but needs to be.
Proposal
Reusing the existing interface for commenting it is possible to expand diffs beyond the changed lines.
- Add support for commenting on an unchanged lines in a changed files (e.g. 50 lines below a change). To reach the unchanged line the user will still need to use the
...
button to expand the diff to reach the unchanged lines. - When the changes tab is opened, the diff should be expanded to show unchanged lines that have comments.
Note: we need to add a field to the usage ping to track adoption
What does success look like, and how can we measure that?
Count the number of comments on unchanged lines in changed files and add to the usage ping.
If we are successful we will make it easy for people to leave comments anywhere on the code in the merge request interface.
Links / references:
- Zendesk issue: https://gitlab.zendesk.com/agent/tickets/16402