Skip to content

Commit f34cd4e

Browse files
committed
fix: satisfy staticcheck gate
1 parent 31e594e commit f34cd4e

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

internal/cli/cli.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,6 @@ func parseTimeout(value string) (time.Duration, error) {
417417
return time.Duration(seconds) * time.Second, nil
418418
}
419419

420-
func skipFlagValue(args []string, index int, flag string) (int, error) {
421-
_, next, err := requireValue(args, index, flag)
422-
return next, err
423-
}
424-
425420
func appendPositional(command string, positionals []string, arg string) ([]string, error) {
426421
if strings.HasPrefix(arg, "-") {
427422
return positionals, fmt.Errorf("unknown %s flag %q", command, arg)

internal/gitlocal/gitlocal_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10-
"sort"
1110
"strings"
1211
"testing"
1312

@@ -351,12 +350,3 @@ func hasToken(args []string, token string) bool {
351350
}
352351
return false
353352
}
354-
355-
func sortedPaths(entries []model.TreeEntry) []string {
356-
paths := make([]string, 0, len(entries))
357-
for _, entry := range entries {
358-
paths = append(paths, entry.Path)
359-
}
360-
sort.Strings(paths)
361-
return paths
362-
}

internal/report/report.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func displayList(keys []string, display func(string) string) string {
125125
}
126126

127127
func displayCategory(category string) string {
128-
return strings.Title(strings.ReplaceAll(category, "_", " "))
128+
return titleWords(strings.ReplaceAll(category, "_", " "))
129129
}
130130

131131
func displayLanguage(language string) string {
@@ -143,10 +143,25 @@ func displayLanguage(language string) string {
143143
case "dockerfile":
144144
return "Dockerfile"
145145
default:
146-
return strings.Title(strings.ReplaceAll(language, "_", " "))
146+
return titleWords(strings.ReplaceAll(language, "_", " "))
147147
}
148148
}
149149

150+
func titleWords(value string) string {
151+
words := strings.Fields(value)
152+
for i, word := range words {
153+
words[i] = titleWord(word)
154+
}
155+
return strings.Join(words, " ")
156+
}
157+
158+
func titleWord(value string) string {
159+
if value == "" {
160+
return value
161+
}
162+
return strings.ToUpper(value[:1]) + strings.ToLower(value[1:])
163+
}
164+
150165
func identity(value string) string { return value }
151166

152167
func band(score int) string {

0 commit comments

Comments
 (0)