Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code coverage is different for text and html rcov formatter in metric_fu #153

Closed
crv opened this issue Oct 17, 2013 · 4 comments · Fixed by #222 or #226
Closed

Code coverage is different for text and html rcov formatter in metric_fu #153

crv opened this issue Oct 17, 2013 · 4 comments · Fixed by #222 or #226
Labels

Comments

@crv
Copy link

crv commented Oct 17, 2013

One other thing which I observed with Rcov in metric_fu is ... If I try to find coverage using the simplecov text formatter and HTML formatter then there is a difference.

I tried to find out the reason why it happens, I found that

If you have method e.g.

class A
  def m(arg1)
    p "this is my method" # Assume that none of the line covered in this method
    if arg1 > 5
        p 'more than 5'
    else
       p 'not more than 5'
    end 
  end 
end 

As per HTML format, the code coverage percent is 2/7 = 0.28 (28% - 7 relevant lines, 2 lines covered 5 lines missed)
As per the text format the code coverage percent is 5/10 = 0.5 (50% - 10 relevant lines, 5 lines covered 5 lines missed)

This is weird. The reason here is text format takes last 3 end statements into the consideration while HTML formatter ignores it.

@bf4
Copy link
Member

bf4 commented Oct 17, 2013

@crv Do I understand you that the simplecov-rcov-text formatter gives different results than the default simplecov formatter?

How are you running the coverage metric? Can you paste the output of metric_fu --debug-info?

@bf4
Copy link
Member

bf4 commented Nov 6, 2013

We should really either implement our own simplecov formatter or finally just abandon an semblance of rcov. Either way, such a PR would be control of coverage back in the hands of metric_fu. Also see #156 where the coverage metric will be run if the external file is found; rather than if it is configured.

@bf4
Copy link
Member

bf4 commented Feb 10, 2014

In any case, thanks for adding a test case, here. I've started spiking out an internal MetricFu formatter #201

bf4 added a commit that referenced this issue Mar 19, 2014
Currently only rcov-format specific

See issue #153 for known bug

Adapted from https://github.com/kina/simplecov-rcov-text/
by @kina, William 'Kina' <thekina@gmail.com>
MIT-licesned
bf4 added a commit that referenced this issue Mar 19, 2014
Currently only rcov-format specific

See issue #153 for known bug

Adapted from https://github.com/kina/simplecov-rcov-text/
by @kina, William 'Kina' <thekina@gmail.com>
MIT-licensed
@bf4
Copy link
Member

bf4 commented Apr 18, 2014

I finally got around to writing this test, and the numbers appear to be 4/7 for both. Did you test this differently or perhaps the bug went away?

https://github.com/metricfu/metric_fu/tree/fix_coverage

bf4 added a commit that referenced this issue Apr 27, 2014
@bf4 bf4 closed this as completed in #222 Apr 27, 2014
bf4 added a commit that referenced this issue May 2, 2014
Will break old RCov behavior where a file is that is loaded, but
no lines executed, will have a coverage percentage.  Under the
new rubric, it will be 0.0, which really is more correct.

Since we've already removed support for running via RCov, this
won't be a problem.
bf4 added a commit that referenced this issue May 2, 2014
Will break old RCov behavior where a file is that is loaded, but
no lines executed, will have a coverage percentage.  Under the
new rubric, it will be 0.0, which really is more correct.

Since we've already removed support for running via RCov, this
won't be a problem.
bf4 added a commit that referenced this issue May 2, 2014
Will break old RCov behavior where a file is that is loaded, but
no lines executed, will have a coverage percentage.  Under the
new rubric, it will be 0.0, which really is more correct.

Since we've already removed support for running via RCov, this
won't be a problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants