style(prreview): adopt go fix rewrites in diff stats and snapshot
This commit is contained in:
2 files changed
+4
-8
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user