Skip to content

Commit

Permalink
feat: ensure the analyse score is up to 1.0 (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
gandarez committed Aug 23, 2023
1 parent 708662a commit 954c5ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions serialise.go
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"io/fs"
"math"
"path/filepath"
"reflect"
"regexp"
Expand Down Expand Up @@ -168,15 +169,15 @@ func NewXMLLexer(from fs.FS, path string) (*RegexLexer, error) {
}

if ok && config.Analyse.Single {
return ra.score
return float32(math.Min(float64(ra.score), 1.0))
}

if ok {
score += ra.score
}
}

return score
return float32(math.Min(float64(score), 1.0))
}
}

Expand Down

0 comments on commit 954c5ae

Please sign in to comment.