Re: rcov 0.5.0: code coverage + callsite info, RubyGems, Ran

fr Mauricio:

Source code, additional information, screenshots… available at

eigenclass.org

Release information:

eigenclass.org

rcov is really very useful.
Thank you for sharing rcov.

Sample cross-referenced report generated by rcov:

eigenclass.org

uber cool.
i think the only thing lacking is a web-based editor that hooks to rcov.
Wherein you can click on any source, edit it, rerun rcov analysis again,
all just using a browser…

This release is the first to include RubyGems packages: both

a binary one for

Win32 and a platform-independent one for all those with a

compiler, (or a lot

of patience, if willing to run rcov in pure-Ruby mode), so

gem install rcov

should work.

tested and runs great in windows and linux.
but i would still love to see a pure ruby rcov (even if it may be slow).

kind regards -botp

On May 30, 2006, at 1:40 PM, Peña, Botp wrote:

On May 30, 2006, at 11:56 AM, Mauricio F. wrote:
Sample cross-referenced report generated by rcov:
http://eigenclass.org/static/rcov-sample-report-crossref/

uber cool.
i think the only thing lacking is a web-based editor that hooks to
rcov. Wherein you can click on any source, edit it, rerun rcov
analysis again, all just using a browser…

I think a way to open up the file in an external editor would be
better. This could be done to work with TextMate easily using its
URL scheme. I’m not sure about other editors. Maybe an --editor-
links option, which accepts one of: TextMate, ?.

using_textmate_from_terminal.html#url_scheme_html

– Daniel

On Tue, May 30, 2006 at 08:40:33PM +0900, Peña, Botp wrote:

Sample cross-referenced report generated by rcov:
http://eigenclass.org/static/rcov-sample-report-crossref/

uber cool.
i think the only thing lacking is a web-based editor that hooks to rcov.
Wherein you can click on any source, edit it, rerun rcov analysis again, all
just using a browser…

Attractive at first sight, but on second thought I don’t think anybody
would
enjoy editing with a browser (unless running an embedded vim or browsing
with
emacs) :slight_smile: I’ll think about integration with the user’s editor of
choice.

This release is the first to include RubyGems packages: both a binary one
for Win32 and a platform-independent one for all those with a compiler,
(or a lot of patience, if willing to run rcov in pure-Ruby mode), so
gem install rcov
should work.

tested and runs great in windows and linux.
but i would still love to see a pure ruby rcov (even if it may be slow).

Actually, rcov will run in pure-Ruby mode if it cannot load rcovrt.
If you install it from the tarball with
ruby setup.rb --without-ext
or using RubyGems and the compilation fails, it’ll fall back to
pure-Ruby and
give you a warning:

batsman@tux-chan:~/src/rcov/examples$ rcov --version
bash: rcov: command not found
batsman@tux-chan:~/src/rcov/examples$ make=bogus-command-foo gem install
rcov
Attempting local installation of ‘rcov’
Local gem file not found: rcov*.gem
Attempting remote installation of ‘rcov’
Select which gem to install for your platform (i686-linux)

  1. rcov 0.5.0.1 (ruby)
  2. rcov 0.5.0.1 (mswin32)
  3. Cancel installation

1
Building native extensions. This could take a while…
/home/batsman/usr/lib/ruby/1.8/fileutils.rb:243: command not found:
bogus-command-foo
/home/batsman/usr/lib/ruby/1.8/fileutils.rb:243: command not found:
bogus-command-foo install
ruby extconf.rb install rcov
creating Makefile

bogus-command-foo

bogus-command-foo install
Successfully installed rcov-0.5.0.1
Installing RDoc documentation for rcov-0.5.0.1…
batsman@tux-chan:~/src/rcov/examples$ rcov --version
rcov 0.5.0 2006-05-30
batsman@tux-chan:~/src/rcov/examples$ rcov --text-coverage --no-html
–no-color a.rb

Since the rcovrt extension couldn’t be loaded, rcov will run in
pure-Ruby
mode, which is about two orders of magnitude slower.

If you’re on win32, you can find a pre-built extension (usable with
recent
One Click Installer and mswin32 builds) at
eigenclass.org .

blergh
yep
Done: 56

a.rb

srand(0)
c = 0
d = 1
10.times do |i|
if rand % (i + 10)
c += i
d += 1
end
end
puts “blergh”
if c > 4*d
# stuff
puts “yep”

else

puts “nope”

# more stuff

end

puts “Done: #{c+d}”

On May 31, 2006, at 6:16 PM, Chris McGrath wrote:

himself)
Maybe this is what you mean (I don’t know ZenTest), but how hot would
it be if someone made an eclipse plugin that did it as a continual
background task (like, did it per file every time you saved) and
popped up little “Attention” icons next to files and underlined the
parts of code that weren’t getting hit by unit testing. drools

But in the mean time rcov is frickin hot!
-Mat

On 30 May 2006, at 13:40, Peña, Botp wrote:

fr Mauricio:

Source code, additional information, screenshots… available at

eigenclass.org

Release information:

eigenclass.org

rcov is really very useful.
Thank you for sharing rcov.

Seconded! I love it. Thank you bery much. My candidate for the “I
want a Pony awards is” Some king of mashup between rcov, rake and
ZenTest. I’d like something so that running tests became something
akin to making a build in a static language, rcov would tell autotest
what tests it needed to re-run based on the profiling information and
whine heavily when you have code that’s called isn’t under test.

/me hopes the lazyweb will provide! (and wishes he had proper time
himself)

Chris

On Jun 1, 2006, at 4:56 AM, Mauricio F. wrote:

(in /home/batsman/src/rcov/head)
39 tests, 415 assertions, 0 failures, 0 errors
if (!is_code?(lastidx) || /^END$/ =~ @lines[-1]) && !
line = @lines[i]

It’s in my repository, and it will be in rcov 0.6.0.

Bravo! What’s your encore gonna be?
I’m no expert in eclipse plugins. And actually the editor is a
little hard to plug from what I understand. But if there’s a way to
get those !! lines in a lightweight machine readable format, it
shouldn’t be too hard to implement the functionality I was talking
about.
-Mat

On Thu, Jun 01, 2006 at 08:10:47AM +0900, Mat S. wrote:

Maybe this is what you mean (I don’t know ZenTest), but how hot would
it be if someone made an eclipse plugin that did it as a continual
background task (like, did it per file every time you saved) and
popped up little “Attention” icons next to files and underlined the
parts of code that weren’t getting hit by unit testing. drools

I don’t know about eclipse, but I implemented this yesterday:

$ rake rcov RCOVOPTS="–save"
[…]

/me edits lib/rcov.rb

… some time later:

$ rake rcov RCOVOPTS="–text-coverage-diff --no-color"
(in /home/batsman/src/rcov/head)
rm -r coverage
/home/batsman/usr/bin/ruby -Ilib:ext/rcovrt “bin/rcov”
–text-coverage-diff --no-color -o “coverage”
“test/test_CodeCoverageAnalyzer.rb” “test/test_FileStatistics.rb”
“test/test_CallSiteAnalyzer.rb”
Loaded suite bin/rcov
Started

Finished in 1.163085 seconds.

39 tests, 415 assertions, 0 failures, 0 errors

================================================================================
!!! Uncovered code introduced in lib/rcov.rb

lib/rcov.rb:207

 def precompute_coverage(comments_run_by_default = true)
   changed = false
   lastidx = lines.size - 1
   if (!is_code?(lastidx) || /^__END__$/ =~ @lines[-1]) && 

!@coverage[lastidx]
!! # mark the last block of comments
!! @coverage[lastidx] ||= :inferred
!! (lastidx-1).downto(0) do |i|
!! break if is_code?(i)
!! @coverage[i] ||= :inferred
!! end
!! end
(0…lines.size).each do |i|
next if @coverage[i]
line = @lines[i]

It’s in my repository, and it will be in rcov 0.6.0.

On Thu, Jun 01, 2006 at 10:25:11PM +0900, Mat S. wrote:

==========
!!! Uncovered code introduced in lib/rcov.rb

lib/rcov.rb:207

[…]

It’s in my repository, and it will be in rcov 0.6.0.

Bravo! What’s your encore gonna be?

chuckle You just gave me one idea. I’ve got a piece of paper on my
desk
where I’ve written about a dozen things I want to implement (I’ve
crossed out
4 so far); I add a couple every once in a while. I’m keeping them more
or less
secret for the time being, but I’ll send a snapshot (tarball and/or
RubyGems
packages) of rcov’s HEAD branch with the new stuff to whoever reports a
new
bug in rcov :slight_smile:

(Reports for bugs I’ve already fixed in HEAD will be requited with a
somewhat
less fresh snapshot :wink:

I’m no expert in eclipse plugins. And actually the editor is a
little hard to plug from what I understand. But if there’s a way to
get those !! lines in a lightweight machine readable format, it
shouldn’t be too hard to implement the functionality I was talking
about.

I wrote --text-coverage-diff with that in mind (although not exactly the
way
you described it). Actually, I was planning some vim integration using
errorformat…