From ebdb7752963d4da6a88f09e5791b8ab9ad91bf96 Mon Sep 17 00:00:00 2001 From: Ankit Pokhrel Date: Sat, 28 Aug 2021 17:57:17 +0200 Subject: [PATCH] chore: Update golangci-lint to 1.41.1 (#125) --- .golangci.yml | 3 +-- Makefile | 2 +- internal/cmd/issue/list/list.go | 4 +++- internal/config/generator.go | 4 +++- internal/view/board.go | 2 +- internal/view/helper.go | 1 + internal/view/issues.go | 2 +- internal/view/project.go | 2 +- internal/view/sprint.go | 2 +- pkg/jira/client.go | 4 +++- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5d21c37e..23500fce 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,14 +12,13 @@ linters: - gocyclo - gofmt - goimports - - golint + - revive - godot - gofumpt - gomnd - gosimple - govet - ineffassign - - interfacer - prealloc - unparam - varcheck diff --git a/Makefile b/Makefile index d3a97ed2..fbed26e8 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ install: lint: @if ! command -v golangci-lint > /dev/null 2>&1; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ - sh -s -- -b "$$(go env GOPATH)/bin" v1.31.0 + sh -s -- -b "$$(go env GOPATH)/bin" v1.41.1 fi golangci-lint run ./... diff --git a/internal/cmd/issue/list/list.go b/internal/cmd/issue/list/list.go index 38cb08e4..1e8aad95 100644 --- a/internal/cmd/issue/list/list.go +++ b/internal/cmd/issue/list/list.go @@ -42,6 +42,8 @@ $ jira issue list -tEpic -sDone # List issues in status other than "Open" and is assigned to no one $ jira issue list -s~Open -ax` + + defaultLimit = 100 ) // NewCmdList is a list command. @@ -143,7 +145,7 @@ func SetFlags(cmd *cobra.Command) { cmd.Flags().String("updated-before", "", "Filter by issues updated before certain date") cmd.Flags().StringP("jql", "q", "", "Run a raw JQL query in a given project context") cmd.Flags().Bool("reverse", false, "Reverse the display order (default is DESC)") - cmd.Flags().Uint("limit", 100, "Number of results to return") + cmd.Flags().Uint("limit", defaultLimit, "Number of results to return") cmd.Flags().Bool("plain", false, "Display output in plain mode") cmd.Flags().Bool("no-headers", false, "Don't display table headers in plain mode. Works only with --plain") cmd.Flags().Bool("no-truncate", false, "Show all available columns in plain mode. Works only with --plain") diff --git a/internal/config/generator.go b/internal/config/generator.go index 975daacd..e82a9d1c 100644 --- a/internal/config/generator.go +++ b/internal/config/generator.go @@ -327,8 +327,10 @@ func shallOverwrite() bool { } func create(path, name string) error { + const perm = 0700 + if !Exists(path) { - if err := os.MkdirAll(path, 0700); err != nil { + if err := os.MkdirAll(path, perm); err != nil { return err } } diff --git a/internal/view/board.go b/internal/view/board.go index faa8cab0..910beb6b 100644 --- a/internal/view/board.go +++ b/internal/view/board.go @@ -25,7 +25,7 @@ func NewBoard(data []*jira.Board, opts ...BoardOption) *Board { data: data, buf: new(bytes.Buffer), } - b.writer = tabwriter.NewWriter(b.buf, 0, 8, 1, '\t', 0) + b.writer = tabwriter.NewWriter(b.buf, 0, tabWidth, 1, '\t', 0) for _, opt := range opts { opt(&b) diff --git a/internal/view/helper.go b/internal/view/helper.go index 93cad13b..d8c4d00f 100644 --- a/internal/view/helper.go +++ b/internal/view/helper.go @@ -19,6 +19,7 @@ import ( const ( wordWrap = 120 + tabWidth = 8 helpText = `USAGE ----- diff --git a/internal/view/issues.go b/internal/view/issues.go index 22ab7354..89e230e4 100644 --- a/internal/view/issues.go +++ b/internal/view/issues.go @@ -38,7 +38,7 @@ type IssueList struct { // Render renders the view. func (l IssueList) Render() error { if l.Display.Plain { - w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0) + w := tabwriter.NewWriter(os.Stdout, 0, tabWidth, 1, '\t', 0) return l.renderPlain(w) } diff --git a/internal/view/project.go b/internal/view/project.go index f3563144..3c144f80 100644 --- a/internal/view/project.go +++ b/internal/view/project.go @@ -25,7 +25,7 @@ func NewProject(data []*jira.Project, opts ...ProjectOption) *Project { data: data, buf: new(bytes.Buffer), } - p.writer = tabwriter.NewWriter(p.buf, 0, 8, 1, '\t', 0) + p.writer = tabwriter.NewWriter(p.buf, 0, tabWidth, 1, '\t', 0) for _, opt := range opts { opt(&p) diff --git a/internal/view/sprint.go b/internal/view/sprint.go index d0672ce7..09e567b6 100644 --- a/internal/view/sprint.go +++ b/internal/view/sprint.go @@ -70,7 +70,7 @@ func (sl SprintList) Render() error { // RenderInTable renders the list in table view. func (sl SprintList) RenderInTable() error { if sl.Display.Plain { - w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0) + w := tabwriter.NewWriter(os.Stdout, 0, tabWidth, 1, '\t', 0) return sl.renderPlain(w) } diff --git a/pkg/jira/client.go b/pkg/jira/client.go index f927c941..160a5696 100644 --- a/pkg/jira/client.go +++ b/pkg/jira/client.go @@ -223,8 +223,10 @@ func dump(req *http.Request, res *http.Response) { } func prettyPrintDump(heading string, data []byte) { + const separatorWidth = 60 + fmt.Printf("\n\n%s", strings.ToUpper(heading)) - fmt.Printf(fmt.Sprintf("\n%s\n\n", strings.Repeat("-", 60))) + fmt.Printf(fmt.Sprintf("\n%s\n\n", strings.Repeat("-", separatorWidth))) fmt.Print(string(data)) }