🚨 Update linter and fix new warnings

This commit is contained in:
Dan Jones 2025-07-02 14:14:04 -05:00
commit 186bf5fcba
4 changed files with 24 additions and 21 deletions

View file

@ -1,7 +1,8 @@
version: "2"
linters: linters:
enable: enable:
- errcheck - errcheck
- gosimple
- govet - govet
- ineffassign - ineffassign
- staticcheck - staticcheck
@ -22,18 +23,17 @@ linters:
- gosec - gosec
- perfsprint - perfsprint
- testifylint - testifylint
settings:
linters-settings: testifylint:
testifylint: enable-all: true
enable-all: true disable:
disable: - require-error
- require-error gocognit:
gocognit: min-complexity: 16
min-complexity: 16 gocyclo:
gocyclo: min-complexity: 15
min-complexity: 15 gocritic:
gocritic: enable-all: true
enable-all: true settings:
settings: hugeParam:
hugeParam: sizeThreshold: 255
sizeThreshold: 255

View file

@ -16,6 +16,7 @@ func main() {
m, err := ic.NewMerger(os.Args[1:]) m, err := ic.NewMerger(os.Args[1:])
e.HandleErr(err) e.HandleErr(err)
//nolint:errcheck // I don't care about this
defer m.Close() defer m.Close()
err = m.ParseFiles() err = m.ParseFiles()

View file

@ -1,6 +1,7 @@
package convids package convids
import ( import (
"cmp"
"context" "context"
"errors" "errors"
"fmt" "fmt"
@ -17,6 +18,7 @@ import (
) )
func NewData(path string) (*Data, error) { func NewData(path string) (*Data, error) {
//nolint:gosec // I don't care if this is user input
f, err := os.Open(path) f, err := os.Open(path)
if err != nil { if err != nil {
return nil, err return nil, err
@ -152,8 +154,8 @@ func WalkFiles(d *Data, stopOnError bool, gp GroupPrinter, cb ShowWalker) (err e
func DryRun(out io.Writer) ShowWalker { func DryRun(out io.Writer) ShowWalker {
return func(s *Show, path string) error { return func(s *Show, path string) error {
fmt.Fprintf(out, "Saving %s to %s\n", path, s.Folder) _, err := fmt.Fprintf(out, "Saving %s to %s\n", path, s.Folder)
return ErrSkipped return cmp.Or(err, ErrSkipped)
} }
} }
@ -175,6 +177,6 @@ func GetShowWithIO(ctx context.Context, stdin io.Reader, stdout, stderr io.Write
func PrintGroupName(out io.Writer) GroupPrinter { func PrintGroupName(out io.Writer) GroupPrinter {
return func(name string, group Shows) { return func(name string, group Shows) {
fmt.Fprintf(out, "Checking %s shows\n\n", name) _, _ = fmt.Fprintf(out, "Checking %s shows\n\n", name)
} }
} }

View file

@ -50,11 +50,11 @@ func (a *App) run(ctx context.Context) error {
} }
func (a *App) runInLoop(ctx context.Context) error { func (a *App) runInLoop(ctx context.Context) error {
fmt.Fprintln(a.stdout, "Looping") _, _ = fmt.Fprintln(a.stdout, "Looping")
var err error var err error
for err == nil { for err == nil {
err = a.run(ctx) err = a.run(ctx)
fmt.Fprintln(a.stdout, err) _, _ = fmt.Fprintln(a.stdout, err)
} }
return err return err
} }