Color coding Gerrit patchsets with code-coverage information

561 views
Skip to first unread message

Øyvind Harboe

unread,
Aug 27, 2015, 8:53:23 AM8/27/15
to Repo and Gerrit Discussion
I would like to color code the new and changed lines in a patchset with code-coverage information.

I have that information available from my build scripts in Python, but I can't find the REST APIs to do so.

Is there a way to do this or does anyone know of work in progress to add this support?


We're not the first to do this, so I was hoping that this would be something that it would be possible to do in the more recent or upcoming versions of Gerrit:


http://googletesting.blogspot.co.uk/2014/07/measuring-coverage-at-google.html

Cheers,
Øyvind

David Pursehouse

unread,
Aug 27, 2015, 8:54:22 PM8/27/15
to Øyvind Harboe, Repo and Gerrit Discussion
On 08/27/2015 09:53 PM, Øyvind Harboe wrote:
> I would like to color code the new and changed lines in a patchset with
> code-coverage information.
>
> I have that information available from my build scripts in Python, but I
> can't find the REST APIs to do so.
>
> Is there a way to do this or does anyone know of work in progress to add
> this support?
>

No, there is no API specifically to colour code lines in a patch set,
and I don't think anyone is working on such a feature. It sounds
interesting though and would be worth adding to the issue tracker as a
feature request.

In the meantime what you could perhaps do is use the existing review
API, which supports line ranges [1], to post a comment (something like
"no test coverage", I suppose?) onto lines in the patch set.

[1]
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input

>
> We're not the first to do this, so I was hoping that this would be
> something that it would be possible to do in the more recent or upcoming
> versions of Gerrit:
>
>
> http://googletesting.blogspot.co.uk/2014/07/measuring-coverage-at-google.html
> <https://eumail.emerson.com/owa/redir.aspx?SURL=u3VYwQ5a23uoiwh8c548TLFmuxhmMQTjmyP3geuHotlzD7l5267SCGgAdAB0AHAAOgAvAC8AZwBvAG8AZwBsAGUAdABlAHMAdABpAG4AZwAuAGIAbABvAGcAcwBwAG8AdAAuAGMAbwAuAHUAawAvADIAMAAxADQALwAwADcALwBtAGUAYQBzAHUAcgBpAG4AZwAtAGMAbwB2AGUAcgBhAGcAZQAtAGEAdAAtAGcAbwBvAGcAbABlAC4AaAB0AG0AbAA.&URL=http%3a%2f%2fgoogletesting.blogspot.co.uk%2f2014%2f07%2fmeasuring-coverage-at-google.html>
>

It looks like your link got mangled by Outlook Web Access.

http://googletesting.blogspot.co.uk/2014/07/measuring-coverage-at-google.html

Øyvind Harboe

unread,
Aug 28, 2015, 4:35:59 AM8/28/15
to Repo and Gerrit Discussion, oyvind...@gmail.com


On Friday, August 28, 2015 at 2:54:22 AM UTC+2, David Pursehouse wrote:
On 08/27/2015 09:53 PM, Øyvind Harboe wrote:
> I would like to color code the new and changed lines in a patchset with
> code-coverage information.
>
> I have that information available from my build scripts in Python, but I
> can't find the REST APIs to do so.
>
> Is there a way to do this or does anyone know of work in progress to add
> this support?
>

No, there is no API specifically to colour code lines in a patch set,
and I don't think anyone is working on such a feature.  It sounds
interesting though and would be worth adding to the issue tracker as a
feature request.

In the meantime what you could perhaps do is use the existing review
API, which supports line ranges [1], to post a comment (something like
"no test coverage", I suppose?) onto lines in the patch set.

[1]
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input


The concern is that it will be horrendously verbose as there are comments on every single line.  I guess some experimentation on our part is required.

We're thinking that a straight code-coverage+1/-1 vote is not going to work well in our workflow as code-coverage is judged more qualitatively than quantitatively for large code-bases which have a lot of history.
Reply all
Reply to author
Forward
0 new messages