Skip to content

Commit

Permalink
Try at fixing FloatDomainError more closely restoring origin version
Browse files Browse the repository at this point in the history
* Fixes #563 hopefully
* tracked the bug back to hopefully b35f569 (only thing
  that touched the caller of the method, but maybe there is some
  other interaction ongoing)
* Guess is/was that this might trigger if there aren't any lines
  covered... obviously test cases still missing to up our
  coverage here :)
  • Loading branch information
PragTob committed Mar 17, 2017
1 parent 7937c93 commit fe29f29
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/simplecov/source_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ def covered_percent
def covered_strength
return 0.0 if no_lines?

round_float(lines_strength / relevant_lines.to_f, 1)
effective_lines_count = Float(relevant_lines)
if effective_lines_count.zero?
0.0
else
round_float(lines_strength / effective_lines_count, 1)
end
end

def no_lines?
lines.length.zero? || lines.length == never_lines.size
lines.length.zero? || (lines.length == never_lines.size)
end

def lines_strength
Expand Down

0 comments on commit fe29f29

Please sign in to comment.