style(prreview): adopt go fix rewrites in diff stats and snapshot

This commit is contained in:
sam committed 2026-09-26 03:24:40 +10:00
1 parent 6641d8a981
commit fb43206cdc
2 files changed
+4 -8

No files matched your search

+1 -4
View File
@@ -397,10 +397,7 @@ func SummarizeFiles(files []FileChange) DiffStats {
}
}
codeFiles := stats.TotalFiles - stats.TestFilesChanged
if codeFiles < 1 {
codeFiles = 1
}
codeFiles := max(stats.TotalFiles-stats.TestFilesChanged, 1)
stats.TestToCodeRatio = float64(stats.TestFilesChanged) / float64(codeFiles)
return stats
}
@@ -6,6 +6,7 @@ import (
"io"
"io/fs"
"path/filepath"
"slices"
"strings"
)
@@ -118,10 +119,8 @@ func readBounded(fsys fs.FS, file string) ([]byte, error) {
// appendUnique adds value to values unless it is already there, which keeps the
// order each caller built.
func appendUnique(values []string, value string) []string {
for _, existing := range values {
if existing == value {
return values
}
if slices.Contains(values, value) {
return values
}
return append(values, value)
}