Skip to content

Commit

Permalink
-Fix the case of digital overflow leads to negative score
Browse files Browse the repository at this point in the history
  • Loading branch information
wgliang committed Aug 17, 2017
1 parent da1a877 commit f8e87b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package engine

import (
"encoding/json"
"math"
"fmt"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -224,7 +225,10 @@ func (r *Reporter) linterCyclo(dirsAll map[string]string) {
errors := make([]Error, 0)
cyclo, avg := cyclo.Cyclo(pkgPath)
avgfloat, _ := strconv.ParseFloat(avg, 64)
sumAverageCyclo = sumAverageCyclo + avgfloat
if math.IsNaN(avgfloat) == false{
sumAverageCyclo = sumAverageCyclo + avgfloat
}

for _, val := range cyclo {
cyclovalues := strings.Split(val, " ")
if len(cyclovalues) == 4 {
Expand Down

0 comments on commit f8e87b7

Please sign in to comment.