Skip to content

chore(deps): update all non-major dependencies #3173

chore(deps): update all non-major dependencies

chore(deps): update all non-major dependencies #3173

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / golangci failed Jan 3, 2024 in 0s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (13)

action/deployment/add.go|1| : # github.com/go-vela/cli/action/deployment [github.com/go-vela/cli/action/deployment.test]
action/deployment/table.go|52 col 42| d.GetUser undefined (type library.Deployment has no field or method GetUser)
action/deployment/table.go|96 col 42| d.GetUser undefined (type library.Deployment has no field or method GetUser)
action/deployment/table_test.go|99 col 4| d.SetUser undefined (type *library.Deployment has no field or method SetUser) (typecheck)
command/deployment/add.go|9 col 2| could not import github.com/go-vela/cli/action/deployment (-: # github.com/go-vela/cli/action/deployment
action/deployment/table.go|52 col 42| d.GetUser undefined (type library.Deployment has no field or method GetUser)
action/deployment/table.go|96 col 42| d.GetUser undefined (type library.Deployment has no field or method GetUser)) (typecheck)
command/repo/add.go|3| 3-200 lines are duplicate of command/repo/update.go:3-198 (dupl)
command/repo/update.go|3| 3-198 lines are duplicate of command/repo/add.go:3-200 (dupl)
action/pipeline/exec.go|24| Function 'Exec' is too long (163 > 160) (funlen)
internal/output/yaml_test.go|72 col 39| unused-parameter: parameter 'unmarshal' seems to be unused, consider removing or renaming it as _ (revive)
command/worker/add.go|3 col 1| directive //nolint:dupl // ignore similar code with update is unused for linter "dupl" (nolintlint)
command/worker/view.go|70 col 1| directive //nolint:dupl // ignore similar code with chown, get, remove and repair is unused for linter "dupl" (nolintlint)

Filtered Findings (0)

Annotations

Check failure on line 1 in action/deployment/add.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/add.go#L1

: # github.com/go-vela/cli/action/deployment [github.com/go-vela/cli/action/deployment.test]
Raw output
action/deployment/add.go:1: : # github.com/go-vela/cli/action/deployment [github.com/go-vela/cli/action/deployment.test]

Check failure on line 52 in action/deployment/table.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/table.go#L52

d.GetUser undefined (type library.Deployment has no field or method GetUser)
Raw output
action/deployment/table.go:52:42: d.GetUser undefined (type library.Deployment has no field or method GetUser)

Check failure on line 96 in action/deployment/table.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/table.go#L96

d.GetUser undefined (type library.Deployment has no field or method GetUser)
Raw output
action/deployment/table.go:96:42: d.GetUser undefined (type library.Deployment has no field or method GetUser)

Check failure on line 99 in action/deployment/table_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/table_test.go#L99

d.SetUser undefined (type *library.Deployment has no field or method SetUser) (typecheck)
Raw output
action/deployment/table_test.go:99:4: d.SetUser undefined (type *library.Deployment has no field or method SetUser) (typecheck)
// SPDX-License-Identifier: Apache-2.0

Check failure on line 9 in command/deployment/add.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] command/deployment/add.go#L9

could not import github.com/go-vela/cli/action/deployment (-: # github.com/go-vela/cli/action/deployment
Raw output
command/deployment/add.go:9:2: could not import github.com/go-vela/cli/action/deployment (-: # github.com/go-vela/cli/action/deployment

Check failure on line 52 in action/deployment/table.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/table.go#L52

d.GetUser undefined (type library.Deployment has no field or method GetUser)
Raw output
action/deployment/table.go:52:42: d.GetUser undefined (type library.Deployment has no field or method GetUser)

Check failure on line 96 in action/deployment/table.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/deployment/table.go#L96

d.GetUser undefined (type library.Deployment has no field or method GetUser)) (typecheck)
Raw output
action/deployment/table.go:96:42: d.GetUser undefined (type library.Deployment has no field or method GetUser)) (typecheck)
	"github.com/go-vela/cli/action/deployment"
	^

Check failure on line 3 in command/repo/add.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] command/repo/add.go#L3

3-200 lines are duplicate of `command/repo/update.go:3-198` (dupl)
Raw output
command/repo/add.go:3: 3-200 lines are duplicate of `command/repo/update.go:3-198` (dupl)
package repo

import (
	"fmt"

	"github.com/go-vela/cli/action"
	"github.com/go-vela/cli/action/repo"
	"github.com/go-vela/cli/internal"
	"github.com/go-vela/cli/internal/client"

	"github.com/go-vela/types/constants"

	"github.com/urfave/cli/v2"
)

// CommandAdd defines the command for creating a repository.
var CommandAdd = &cli.Command{
	Name:        "repo",
	Description: "Use this command to add a repository.",
	Usage:       "Add a new repository from the provided configuration",
	Action:      add,
	Flags: []cli.Flag{

		// Repo Flags

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "REPO_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "REPO_NAME"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the name for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_BRANCH", "REPO_BRANCH"},
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "default branch for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_LINK", "REPO_LINK"},
			Name:    "link",
			Aliases: []string{"l"},
			Usage:   "full URL to repository in source control",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_CLONE", "REPO_CLONE"},
			Name:    "clone",
			Aliases: []string{"c"},
			Usage:   "full clone URL to repository in source control",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_VISIBILITY", "REPO_VISIBILITY"},
			Name:    "visibility",
			Aliases: []string{"v"},
			Usage:   "access level required to view the repository",
			Value:   constants.VisibilityPublic,
		},
		&cli.Int64Flag{
			EnvVars: []string{"VELA_BUILD_LIMIT", "REPO_BUILD_LIMIT"},
			Name:    "build.limit",
			Usage:   "limit of concurrent builds allowed in repository",
			Value:   constants.BuildLimitDefault,
		},
		&cli.Int64Flag{
			EnvVars: []string{"VELA_TIMEOUT", "REPO_TIMEOUT"},
			Name:    "timeout",
			Aliases: []string{"t"},
			Usage:   "max time allowed per build in repository",
			Value:   constants.BuildTimeoutDefault,
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_COUNTER", "REPO_COUNTER"},
			Name:    "counter",
			Aliases: []string{"ct"},
			Usage:   "set a value for a new build number",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PRIVATE", "REPO_PRIVATE"},
			Name:    "private",
			Aliases: []string{"p"},
			Usage:   "disable public access to the repository",
			Value:   "false",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TRUSTED", "REPO_TRUSTED"},
			Name:    "trusted",
			Aliases: []string{"tr"},
			Usage:   "elevated permissions for builds executed for repo",
			Value:   "false",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_ACTIVE", "REPO_ACTIVE"},
			Name:    "active",
			Aliases: []string{"a"},
			Usage:   "current status of the repository",
			Value:   "true",
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_EVENTS", "REPO_EVENTS", "VELA_ADD_EVENTS", "REPO_ADD_EVENTS"},
			Name:    "event",
			Aliases: []string{"events", "add-event", "add-events", "e"},
			Usage:   "webhook event(s) repository responds to",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PIPELINE_TYPE", "PIPELINE_TYPE"},
			Name:    "pipeline-type",
			Aliases: []string{"pt"},
			Usage:   "type of base pipeline for the compiler to render",
			Value:   constants.PipelineTypeYAML,
		},

		// Output Flags

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "REPO_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Add a repository with push and pull request enabled.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --event push --event pull_request
  2. Add a repository with all event types enabled.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --event push --event pull_request --event tag --event deployment --event comment
  3. Add a repository with a longer build timeout.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --timeout 90
  4. Add a repository when config or environment variables are set.
    $ {{.HelpName}} --event push --event pull_request
  5. Add a repository with a starting build number.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --counter 90
  6. Add a repository with a starlark pipeline file.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --pipeline-type starlark

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/repo/add/
`, cli.CommandHelpTemplate),
}

// helper function to capture the provided input
// and create the object used to create a repo.
func add(c *cli.Context) error {
	// load variables from the config file
	err := action.Load(c)
	if err != nil {
		return err
	}

	// parse the Vela client from the context
	//
	// https://pkg.go.dev/github.com/go-vela/cli/internal/client?tab=doc#Parse
	client, err := client.Parse(c)
	if err != nil {
		return err
	}

	// create the repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config
	r := &repo.Config{
		Action:       internal.ActionAdd,
		Org:          c.String(internal.FlagOrg),
		Name:         c.String(internal.FlagRepo),
		Branch:       c.String("branch"),
		Link:         c.String("link"),
		Clone:        c.String("clone"),
		Visibility:   c.String("visibility"),
		BuildLimit:   c.Int64("build.limit"),
		Timeout:      c.Int64("timeout"),
		Counter:      c.Int("counter"),
		Private:      c.Bool("private"),
		Trusted:      c.Bool("trusted"),
		Active:       c.Bool("active"),
		Events:       c.StringSlice("event"),
		PipelineType: c.String("pipeline-type"),
		Output:       c.String(internal.FlagOutput),
	}

	// validate repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config.Validate
	err = r.Validate()
	if err != nil {
		return err
	}

	// execute the add call for the repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config.Add
	return r.Add(client)
}

Check failure on line 3 in command/repo/update.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] command/repo/update.go#L3

3-198 lines are duplicate of `command/repo/add.go:3-200` (dupl)
Raw output
command/repo/update.go:3: 3-198 lines are duplicate of `command/repo/add.go:3-200` (dupl)
package repo

import (
	"fmt"

	"github.com/go-vela/cli/action"
	"github.com/go-vela/cli/action/repo"
	"github.com/go-vela/cli/internal"
	"github.com/go-vela/cli/internal/client"

	"github.com/go-vela/types/constants"

	"github.com/urfave/cli/v2"
)

// CommandUpdate defines the command for modifying a repository.
var CommandUpdate = &cli.Command{
	Name:        "repo",
	Description: "Use this command to update a repository.",
	Usage:       "Update a new repository from the provided configuration",
	Action:      update,
	Flags: []cli.Flag{

		// Repo Flags

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "REPO_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "REPO_NAME"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the name for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_BRANCH", "REPO_BRANCH"},
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "default branch for the repository",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_LINK", "REPO_LINK"},
			Name:    "link",
			Aliases: []string{"l"},
			Usage:   "full URL to repository in source control",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_CLONE", "REPO_CLONE"},
			Name:    "clone",
			Aliases: []string{"c"},
			Usage:   "full clone URL to repository in source control",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_VISIBILITY", "REPO_VISIBILITY"},
			Name:    "visibility",
			Aliases: []string{"v"},
			Usage:   "access level required to view the repository",
			Value:   constants.VisibilityPublic,
		},
		&cli.Int64Flag{
			EnvVars: []string{"VELA_BUILD_LIMIT", "REPO_BUILD_LIMIT"},
			Name:    "build.limit",
			Usage:   "limit of concurrent builds allowed in repository",
			Value:   constants.BuildLimitDefault,
		},
		&cli.Int64Flag{
			EnvVars: []string{"VELA_TIMEOUT", "REPO_TIMEOUT"},
			Name:    "timeout",
			Aliases: []string{"t"},
			Usage:   "max time allowed per build in repository",
			Value:   constants.BuildTimeoutDefault,
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_COUNTER", "REPO_COUNTER"},
			Name:    "counter",
			Aliases: []string{"ct"},
			Usage:   "set a value for a new build number",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PRIVATE", "REPO_PRIVATE"},
			Name:    "private",
			Aliases: []string{"p"},
			Usage:   "disable public access to the repository",
			Value:   "false",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TRUSTED", "REPO_TRUSTED"},
			Name:    "trusted",
			Aliases: []string{"tr"},
			Usage:   "elevated permissions for builds executed for repo",
			Value:   "false",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_ACTIVE", "REPO_ACTIVE"},
			Name:    "active",
			Aliases: []string{"a"},
			Usage:   "current status of the repository",
			Value:   "true",
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_EVENTS", "REPO_EVENTS", "VELA_ADD_EVENTS", "REPO_ADD_EVENTS"},
			Name:    "event",
			Aliases: []string{"events", "add-event", "add-events", "e"},
			Usage:   "webhook event(s) repository responds to",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PIPELINE_TYPE", "PIPELINE_TYPE"},
			Name:    "pipeline-type",
			Aliases: []string{"pt"},
			Usage:   "type of base pipeline for the compiler to render",
			Value:   constants.PipelineTypeYAML,
		},

		// Output Flags

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "REPO_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Update a repository with push and pull request enabled.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --event push --event pull_request
  2. Update a repository with all event types enabled.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --event push,pull_request,tag,deployment,comment
  3. Update a repository with a longer build timeout.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --timeout 90
  4. Update a repository when config or environment variables are set.
    $ {{.HelpName}}
  5. Update a repository with a new build number.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --counter 200

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/repo/update/
`, cli.CommandHelpTemplate),
}

// helper function to capture the provided input
// and create the object used to modify a repository.
func update(c *cli.Context) error {
	// load variables from the config file
	err := action.Load(c)
	if err != nil {
		return err
	}

	// parse the Vela client from the context
	//
	// https://pkg.go.dev/github.com/go-vela/cli/internal/client?tab=doc#Parse
	client, err := client.Parse(c)
	if err != nil {
		return err
	}

	// create the repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config
	r := &repo.Config{
		Action:       internal.ActionUpdate,
		Org:          c.String(internal.FlagOrg),
		Name:         c.String(internal.FlagRepo),
		Branch:       c.String("branch"),
		Link:         c.String("link"),
		Clone:        c.String("clone"),
		Visibility:   c.String("visibility"),
		BuildLimit:   c.Int64("build.limit"),
		Timeout:      c.Int64("timeout"),
		Counter:      c.Int("counter"),
		Private:      c.Bool("private"),
		Trusted:      c.Bool("trusted"),
		Active:       c.Bool("active"),
		Events:       c.StringSlice("event"),
		PipelineType: c.String("pipeline-type"),
		Output:       c.String(internal.FlagOutput),
	}

	// validate repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config.Validate
	err = r.Validate()
	if err != nil {
		return err
	}

	// execute the update call for the repo configuration
	//
	// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config.Update
	return r.Update(client)
}

Check failure on line 24 in action/pipeline/exec.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] action/pipeline/exec.go#L24

Function 'Exec' is too long (163 > 160) (funlen)
Raw output
action/pipeline/exec.go:24: Function 'Exec' is too long (163 > 160) (funlen)
func (c *Config) Exec(client compiler.Engine) error {

Check failure on line 72 in internal/output/yaml_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] internal/output/yaml_test.go#L72

unused-parameter: parameter 'unmarshal' seems to be unused, consider removing or renaming it as _ (revive)
Raw output
internal/output/yaml_test.go:72:39: unused-parameter: parameter 'unmarshal' seems to be unused, consider removing or renaming it as _ (revive)
func (f *failMarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error {
                                      ^

Check failure on line 3 in command/worker/add.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] command/worker/add.go#L3

directive `//nolint:dupl // ignore similar code with update` is unused for linter "dupl" (nolintlint)
Raw output
command/worker/add.go:3:1: directive `//nolint:dupl // ignore similar code with update` is unused for linter "dupl" (nolintlint)
//nolint:dupl // ignore similar code with update
^

Check failure on line 70 in command/worker/view.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] command/worker/view.go#L70

directive `//nolint:dupl // ignore similar code with chown, get, remove and repair` is unused for linter "dupl" (nolintlint)
Raw output
command/worker/view.go:70:1: directive `//nolint:dupl // ignore similar code with chown, get, remove and repair` is unused for linter "dupl" (nolintlint)
//nolint:dupl // ignore similar code with chown, get, remove and repair
^