Review helper

A code review is a pretty hard process, one of the hard thing for me is to track code movement. I mean if you see that some method is deleted you don't really know if it was moved or just deleted. What if we could indicate that?

Screen_Shot_2017-04-11_at_18.14.45

I propose to show a small circle with a number of occasions in the current diff (commit/MR). On mouse hover, we show a tooltip with a list of links to each occasion (BTW Some code editors do that to show a method definition for example).

Screen_Shot_2017-04-11_at_17.48.43

If you click on the link you jump to that place. Also, I think we could show the occasions only for opposite actions. I mean, if we are at removed line we show only those occasions where this line is added. It should be pretty cheap feature and all the calculation should be on client side (JS)

How would it work

I propose to implement this solely on JS side.

Every line of code should be trimmed (!) and placed to the appropriate hash (pre-parsing stage)

removedLines[line] = [link_to_the_line, link_to_the_line2]
...
addedLines[line] =  [link_to_the_line]

After pre-parsing, we can go over each line and show the helper next to it as we already know how many times we saw it and where exactly.

The dirty implementation should not take more than several hours. So it's pretty cheap.

In the future, we could calculate a Levenshtein distance between the lines of code to catch cases like

- def method(arg1)

+ def method(arg2)

@victorwu @JobV @DouweM @smcgivern What do you think?

Edited Sep 02, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading