diff --git a/Taskfile.yml b/Taskfile.yml index 77b972d..8be3d99 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -9,6 +9,32 @@ tasks: - "**/*.go" cmds: - go fmt ./... + + vet: + desc: Vet go code + sources: + - '**/*.go' + cmds: + - go vet ./... + critic: + desc: Critique go code + sources: + - '**/*.go' + cmds: + - gocritic check ./... + staticcheck: + desc: Static check go code + sources: + - '**/*.go' + cmds: + - staticcheck ./... + analyze: + desc: Do static analysis + deps: + - vet + - critic + - staticcheck + cmd-build: internal: true cmds: diff --git a/cli/spin/spin.go b/cli/spin/spin.go index 2896335..3d0a804 100644 --- a/cli/spin/spin.go +++ b/cli/spin/spin.go @@ -82,11 +82,12 @@ func (s *spin) SetMessage(msg string) { } func (s *spin) Err() error { - if errors.Is(s.err, context.Canceled) { + switch { + case errors.Is(s.err, context.Canceled): return nil - } else if errors.Is(s.err, context.DeadlineExceeded) { + case errors.Is(s.err, context.DeadlineExceeded): return nil - } else if errors.Is(s.err, tea.ErrProgramKilled) { + case errors.Is(s.err, tea.ErrProgramKilled): return nil } return s.err diff --git a/convids/methods.go b/convids/methods.go index 69ce198..8162848 100644 --- a/convids/methods.go +++ b/convids/methods.go @@ -38,10 +38,7 @@ func (s *Show) matchRegexp(path string) (f bool, err error) { if s.re == nil { p := s.Pattern if s.Anime { - if strings.HasPrefix(p, "^") { - p = strings.TrimPrefix(p, "^") - } - p = animePattern + p + p = animePattern + strings.TrimPrefix(p, "^") } else if !strings.HasPrefix(p, "^") { p = "^" + p } @@ -71,7 +68,7 @@ func (d *Data) AllShows(silent bool) iter.Seq[*Show] { continue } if !silent { - fmt.Println("Checking", show, "shows\n") + fmt.Printf("Checking %s shows\n\n", show) } for s := range sh.All() { if s == nil {