From 954c5ae91520b279db48d6a82fb2716a14b5e177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Henrique=20Guard=C3=A3o=20Gandarez?= <782854+gandarez@users.noreply.github.com> Date: Wed, 23 Aug 2023 17:31:46 -0300 Subject: [PATCH] feat: ensure the analyse score is up to 1.0 (#832) --- serialise.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/serialise.go b/serialise.go index a0c072785..f29dc5d7e 100644 --- a/serialise.go +++ b/serialise.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "io/fs" + "math" "path/filepath" "reflect" "regexp" @@ -168,7 +169,7 @@ 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 { @@ -176,7 +177,7 @@ func NewXMLLexer(from fs.FS, path string) (*RegexLexer, error) { } } - return score + return float32(math.Min(float64(score), 1.0)) } }