Code Coverage exclusion
I've noticed that simple Ruby parts aren't excluded in the live coverage. "else" and "end" statements for example. Is there a way to get these included in the code coverage so 100% coverage can be obtained? I've tried searching docs and the forum and haven't seen anything regarding it.
请先登录再写评论。
Hello David,
At the moment RubyMine mostly depends on coverage info provided by rcov gem. In future RubyMine versions we are going to differ source and non-source code lines more accurate according to info provided by RubyMine parser. Probably your problem will be also automatically fixed. You may submit an issue at http://youtrack.jetbrains.net/issues/ruby
Before I file a issue, can you explain it a little bit more? Take this scenario for example:
So by my understanding, if it's using rcov throughout the entire process, shouldn't the love coverage show it at 100% instead of 75%? I'll go ahead and file a bug but I wanted to make sure I was communicating the right information.
total lines count = 13
covered lines (according rcov - green) = 6
possibly covered lines (according rcov - grey) = 4
rcov: src lines count = 10
rcov: total file coverage = 10 / 13 = 76,92 %
rcov: code coverage = 7 / 10 = 70 % ( I assume 7 = 6 green lines + grey 'end')
RubyMine: src lines count = 10 (non-src lines doesn't contain green/red gutter)
RubyMine: code coverage = 6 / 10 = 60% (6 green lines)
Here RubyMine and rcov use simple heuristics (based on regexps and finite state machine) to differ src and non-src code and detect a line-comment and two empty lines. RCov report is a bit strange here, by some reason "end" and "def .." lines has different coverage. More over line 8 differs from 12 and 13. So coverage percent is not too accurate both in rcov and RubyMine reports. Here RubyMine can correct a bit coverage data provided by rcov gem and better handle methods/class/blocks declarations start and end.
Most likely in some cases rcov gem heuristics is a bit more accurate.
See issue http://youtrack.jetbrains.net/issue/RUBY-8136