Skip to content

Commit

Permalink
fix pre-commit run
Browse files Browse the repository at this point in the history
  • Loading branch information
batmac committed Jul 16, 2024
1 parent 4b236c7 commit bcf4544
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ linters:
# - structcheck
- stylecheck
- tagalign
- tagliatelle
# - tagliatelle
- tenv
- testableexamples
- testpackage
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ repos:
# - id: go-mod-tidy
- id: golangci-lint # requires github.com/golangci/golangci-lint
args:
["--allow-parallel-runners", "--go=1.17", "--config=.golangci.yml"]
["--allow-parallel-runners", "--config=.golangci.yml"]
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.421.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion cmd/ccat/memoryUsage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func TestPrintMemUsage(t *testing.T) {
{name: "donotpanicplease"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
PrintMemUsage()
})
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/ccat/processfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Test_processFile(t *testing.T) {
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
processFile(io.Discard, tt.args.path)
processFileAsIs(io.Discard, tt.args.path)
})
Expand All @@ -42,7 +42,7 @@ func Test_setError(t *testing.T) {
{"donotpanicplease"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
setErrored()
})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ccat/stdout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import "testing"

func Test_setupStdout(t *testing.T) {
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
_ = setupStdout(false)
_ = setupStdout(true)
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/ccat/ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func Test_uiWrapProcessFile(t *testing.T) {
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
_ = uiWrapProcessFile(func(io.Writer, string) {})
})
}
2 changes: 1 addition & 1 deletion magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Default = BuildDefaultAndTest
var (
defaultBuildArgs = []string{"build"}
binaryName = "ccat"
goBin = mg.GoCmd()
goBin = mg.GoCmd()
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions pkg/color/color256.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (c C256) Sprint(s string) string {

// #nosec
func (c *C256) Next() Color {
rand.Seed(int64(*c))
n := C256(rand.Intn(230))
rand.Seed(int64(*c)) //nolint:staticcheck
n := C256(rand.Intn(230)) //nolint:gosec
return &n
}
2 changes: 1 addition & 1 deletion pkg/completion/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestPrint(t *testing.T) {
{"bash", args{"bash", []string{}}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
completion.Print(tt.args.shell, tt.args.opts)
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/globalctx/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (

func TestSet(t *testing.T) {
for _, tt := range testsGlobalCtx {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
globalctx.Set(tt.k, tt.v)
})
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/highlighter/chroma.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"math/rand"
"os"
"strings"
"time"

"github.com/batmac/ccat/pkg/log"
"github.com/batmac/ccat/pkg/stringutils"
Expand Down Expand Up @@ -96,7 +95,7 @@ func (h *Chroma) highLight(w io.WriteCloser, r io.ReadCloser, o Options) error {
stylesList := styles.Names()
switch {
case o.StyleHint == "random":
rand.Seed(time.Now().UnixNano())
// rand.Seed(time.Now().UnixNano())
//#nosec G404 (weak rand)
randStyle := rand.Intn(len(stylesList))
h.style = stylesList[randStyle]
Expand Down
2 changes: 1 addition & 1 deletion pkg/miniclaude/messagesapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (c *Request) Stream(mr *MessagesRequest) error {
if resp.StatusCode != http.StatusOK {
log.Printf("http unexpected status code: %s", resp.Status)
// dump the body
io.Copy(os.Stderr, resp.Body)
_, _ = io.Copy(os.Stderr, resp.Body)
return fmt.Errorf("http unexpected status code: %d (%s)", resp.StatusCode, resp.Status)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/openers/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
)

func init() {
rand.Seed(time.Now().UnixNano())
// rand.Seed(time.Now().UnixNano())

go func() {
// find an available port
Expand Down
2 changes: 1 addition & 1 deletion pkg/openers/prng.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (f prngOpener) Open(s string, _ bool) (io.ReadCloser, error) {
return nil, err
}
}
rand.Seed(seed)
rand.Seed(seed) //nolint:staticcheck
log.Debugf("seed : %d", seed)
pcg := pcg.NewPCG32(rand.Uint64(), rand.Uint64()) // #nosec
n := int64(0)
Expand Down
2 changes: 1 addition & 1 deletion pkg/selfupdate/selfupdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func Test_Do(t *testing.T) {
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
selfupdate.Do("v0+dev", "", selfupdate.ModeCheckOnly)
selfupdate.Do("100", "", selfupdate.ModeCheckOnly)
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/term/art_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestPrintArt(t *testing.T) {
{"gif", args{r}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
term.PrintArt(tt.args.r)
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/term/osc52_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func TestOsc52(t *testing.T) {
something := []byte("This is a test string from ccat testing (TestOsc52)")
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
term.Osc52(something)
})
}
2 changes: 1 addition & 1 deletion pkg/term/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestIsSsh(t *testing.T) {
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
_ = term.IsSSH()
})
}
2 changes: 1 addition & 1 deletion pkg/term/term_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestGetTerminalSize(t *testing.T) {
}

func TestClearScreen(t *testing.T) {
t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
term.ClearScreen()
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/isstringinfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestIsStringInFile(t *testing.T) {
t.Fatal(err)
}

t.Run("donotpanicplease", func(t *testing.T) {
t.Run("donotpanicplease", func(_ *testing.T) {
got := utils.IsStringInFile(" ", exe)
log.Debugf("%v\n", got)
})
Expand Down

0 comments on commit bcf4544

Please sign in to comment.