Vim report for Devel::Cover (Perl QA Hackathon) - part 2

At last week's QA Hackathon in Paris I put together a Vim report for Devel::Cover to show coverage information as Vim signs. See https://blogs.perl.org/users/paul_johnson/2012/03/vim-report-for-develcover-perl-qa-hackathon.html

Whilst nice, and somewhat useful, this was very much a proof of concept. It only worked for statement coverage, it wasn't particularly clever, nor was it particularly pretty.

I've just released Devel::Cover version 0.86 which solves a number of these problems. It shows all types of coverage data (that Devel::Cover knows about), it seems to be pretty usable (at least in the way I use vim), and it provides a way to customise it to make it pretty (I'm fairly happy with the way mine looks).

cov1.png

In this image you can see some of the features. The column on the left-hand side shows the coverage information. Five coverage criteria are displayed as:

P - Pod coverage
S - Statement coverage
R - Subroutine coverage
B - Branch coverage
C - Condition coverage

Successfully covered criteria are displayed in green, uncovered criteria in red. Since only one criterion can be displayed, the most important is chosen. In the list above, lower criteria are more important. Any uncovered criterion is displayed in preference to a covered criterion.

Thus, in line 69, although the statement is covered, as is the subroutine, there is is no pod coverage and so we see a red P. Lines 70, 72 and 73 are covered statements, hence the green S. Line 74 is a covered statement too, but it is also a covered branch, so we see a green B. Line 77 is an uncovered condition resulting in a red C. You get the idea.

cov2.png

If you are editing a file, coverage information can get out of date. Vim does its best to move signs appropriately when you are editing, but in the image above you can see a file being edited with out of date coverage data and the left hand coverage column has a red hue to make this more apparent.

Since I don't know your colour scheme, this is all customisable by adding an appropriate devel-cover.vim file somewhere under your ~/.vim directory. I use the dark solarized theme (http://ethanschoonover.com/solarized) and have included my cutomised devel-cover.vim file in the docs so you can copy from it.

I can see this becoming a standard tool that I use during my development. I'm really thankful to Miyagawa for pointing me in the right direction at the QA Hackathon.

And on that note, many, many thanks to Laurent Boivin (elbeho), Philippe Bruhat (BooK) and the Les Mongueurs de Perl for the organisation, which was just about perfect. Additionally, the event would not have been possible without sponsors: The City of Science and Industry, Diabolo.com, Dijkmat, DuckDuckGo, Dyn, Freeside Internet Services, Hedera Technology, Jaguar Network, Mongueurs de Perl, Shadowcat Systems Limited, SPLIO, TECLIB', Weborama, and $foo Magazine and individual donations from Martin Evans, Mark Keating, Prakash Kailasa, Neil Bowers, 加藤 敦 (Ktat), Karen Pauley, Chad Davis, Franck Cuny, 近藤嘉雪, Tomohiro Hosaka, Syohei Yoshida, 牧 大輔 (lestrrat), and Laurent Boivin.

The effects of those few days in Paris will be felt for weeks and months to come, so thanks again to all the sponsors and individuals who made it happen.

Finally, I am applying for a grant from TPF to help push Devel::Cover work forward. The time for feedback is drawing to a close, so if you have any comments you'd like to make about that, please leave them at http://news.perlfoundation.org/2012/04/grant-application-improving-de.html

Leave a comment

About Paul Johnson

user-pic I don't really blog about Perl.