Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
Prevent division by zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
micheh committed Dec 23, 2015
1 parent 73900ba commit 9573609
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions teamcity-clover.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
'CodeCoverageAbsMCovered' => (int) $metrics['coveredmethods'],
'CodeCoverageAbsCTotal' => (int) $metrics['classes'],
'CodeCoverageAbsCCovered' => $coveredClasses,
'CodeCoverageB' => $metrics['coveredstatements'] / $metrics['statements'] * 100,
'CodeCoverageL' => $metrics['coveredelements'] / $metrics['elements'] * 100,
'CodeCoverageM' => $metrics['coveredmethods'] / $metrics['methods'] * 100,
'CodeCoverageC' => $coveredClasses / $metrics['classes'] * 100,
'CodeCoverageB' => $metrics['statements'] ? ($metrics['coveredstatements'] / $metrics['statements'] * 100) : 0,
'CodeCoverageL' => $metrics['elements'] ? ($metrics['coveredelements'] / $metrics['elements'] * 100) : 0,
'CodeCoverageM' => $metrics['methods'] ? ($metrics['coveredmethods'] / $metrics['methods'] * 100) : 0,
'CodeCoverageC' => $metrics['classes'] ? ($coveredClasses / $metrics['classes'] * 100) : 0,
'Files' => (int) $metrics['files'],
'LinesOfCode' => (int) $metrics['loc'],
'NonCommentLinesOfCode' => (int) $metrics['ncloc'],
Expand Down

0 comments on commit 9573609

Please sign in to comment.