Skip to content

Commit

Permalink
chore: Fix unused-parameter lints
Browse files Browse the repository at this point in the history
  • Loading branch information
bcyran committed Apr 1, 2024
1 parent 9f21629 commit 741803c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ linters:
- unconvert
- unparam
- whitespace

linters-settings:
revive:
rules:
- name: unused-parameter
arguments:
- allowRegex: "^_.*"
14 changes: 7 additions & 7 deletions bumper/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (provider *fakeVersionProvider) Equal(_ interface{}) bool {
}

func TestCheckAction_Success(t *testing.T) {
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider {
verProvFactory := func(_url string, providersConfig config.Value) upstream.VersionProvider {
return &fakeVersionProvider{version: providersConfig.Get("fakeVersionProvider").String()}
}
action := NewCheckAction(verProvFactory, fakeVersionCheckConfig)
Expand All @@ -67,7 +67,7 @@ func TestCheckAction_Success(t *testing.T) {
}

func TestCheckAction_SuccessVersionOverride(t *testing.T) {
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider {
verProvFactory := func(_url string, _providersConfig config.Value) upstream.VersionProvider {
t.Error("provider should not be called when version override provided")
return nil
}
Expand All @@ -93,7 +93,7 @@ func TestCheckAction_SuccessVersionOverride(t *testing.T) {
}

func TestCheckAction_Skip(t *testing.T) {
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider { return nil }
verProvFactory := func(_url string, _providersConfig config.Value) upstream.VersionProvider { return nil }
action := NewCheckAction(verProvFactory, emptyCheckConfig)
pkg := pack.Package{
Srcinfo: &pack.Srcinfo{
Expand All @@ -111,7 +111,7 @@ func TestCheckAction_Skip(t *testing.T) {
}

func TestCheckAction_FailNoProvider(t *testing.T) {
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider { return nil }
verProvFactory := func(_url string, _providersConfig config.Value) upstream.VersionProvider { return nil }
action := NewCheckAction(verProvFactory, emptyCheckConfig)
pkg := pack.Package{Srcinfo: &pack.Srcinfo{URL: "foo"}}

Expand All @@ -124,7 +124,7 @@ func TestCheckAction_FailNoProvider(t *testing.T) {

func TestCheckAction_FailProviderFailed(t *testing.T) {
expectedErr := "some random error"
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider {
verProvFactory := func(_url string, _providersConfig config.Value) upstream.VersionProvider {
return &fakeVersionProvider{err: fmt.Errorf(expectedErr)}
}
action := NewCheckAction(verProvFactory, emptyCheckConfig)
Expand All @@ -140,7 +140,7 @@ func TestCheckAction_FailProviderFailed(t *testing.T) {
func TestCheckAction_FailChecksMultipleURLs(t *testing.T) {
expectedErr := "some random error"
checkedURLs := []string{}
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider {
verProvFactory := func(url string, _providersConfig config.Value) upstream.VersionProvider {
checkedURLs = append(checkedURLs, url)
return &fakeVersionProvider{err: fmt.Errorf(expectedErr)}
}
Expand All @@ -163,7 +163,7 @@ func TestCheckAction_FailChecksMultipleURLs(t *testing.T) {
}

func TestCheckAction_FailInvalidVersionOverride(t *testing.T) {
verProvFactory := func(url string, providersConfig config.Value) upstream.VersionProvider {
verProvFactory := func(_url string, _providersConfig config.Value) upstream.VersionProvider {
t.Error("provider should not be called when version override provided")
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/bumper/bumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ enables you to run bumper in a dir containing multiple package dirs.`,
actions := createActions(doActions, bumperConfig)
runBumper(workDir, actions)
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
ValidArgsFunction: func(_cmd *cobra.Command, _args []string, _toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveFilterDirs
},
}
Expand All @@ -111,7 +111,7 @@ func init() {
bumperCmd.Flags().StringVarP(&configPath, "config", "", "", "path to configuration file")
bumperCmd.Flags().StringVarP(&completion, "completion", "", "", "generate completion for shell: bash, zsh, fish")
bumperCmd.Flags().StringArrayVarP(&versionOverrides, "override", "o", []string{}, "override upstream version, format: package=version")
bumperCmd.RegisterFlagCompletionFunc("completion", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { //nolint:errcheck
bumperCmd.RegisterFlagCompletionFunc("completion", func(_cmd *cobra.Command, _args []string, _toComplete string) ([]string, cobra.ShellCompDirective) { //nolint:errcheck
return []string{"bash", "zsh", "fish"}, cobra.ShellCompDirectiveDefault
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/testutils/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func NoHeaderMatcher(header string) gock.MatchFunc {
return func(request *http.Request, requestMock *gock.Request) (bool, error) {
return func(request *http.Request, _requestMock *gock.Request) (bool, error) {
return request.Header.Get(header) == "", nil
}
}

0 comments on commit 741803c

Please sign in to comment.