Skip to content

Commit

Permalink
chore: linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Apr 3, 2024
1 parent b980d8a commit 2f2550f
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 26 deletions.
18 changes: 9 additions & 9 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
run:
modules-download-mode: readonly
skip-dirs:
- .git
- .github
- .vscode
- bin
- dist
- man
- testdata

linters:
disable-all: true
Expand Down Expand Up @@ -42,14 +34,22 @@ linters-settings:
goimports:
local-prefixes: github.com/axiomhq/cli
govet:
check-shadowing: true
shadow: true
nolintlint:
allow-unused: false
allow-leading-space: false
require-explanation: true
require-specific: true

issues:
exclude-dirs:
- .git
- .github
- .vscode
- bin
- dist
- man
- testdata
exclude-rules:
- linters:
- staticcheck
Expand Down
4 changes: 2 additions & 2 deletions internal/client/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestLogin_AuthorizationError(t *testing.T) {

r := http.NewServeMux()
r.Handle("/oauth/authorize", http.HandlerFunc(authHf))
r.Handle("/oauth/token", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Handle("/oauth/token", http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
t.Error("should not be called")
}))

Expand Down Expand Up @@ -140,7 +140,7 @@ func TestLogin_ExchangeError(t *testing.T) {
http.Redirect(w, r, redirectURI.String(), http.StatusFound)
}

tokenHf := func(w http.ResponseWriter, r *http.Request) {
tokenHf := func(w http.ResponseWriter, _ *http.Request) {
code := http.StatusInternalServerError
http.Error(w, http.StatusText(code), code)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/auth/auth_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func newStatusCmd(f *cmdutil.Factory) *cobra.Command {
cmdutil.NeedsValidDeployment(f, &opts.Alias),
),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return runStatus(cmd.Context(), opts)
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/auth/auth_update_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func newUpdateTokenCmd(f *cmdutil.Factory) *cobra.Command {
return completeUpdateToken(opts)
},

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return runUpdateToken(cmd.Context(), opts)
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/completion/completion_zsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func newZshCmd(f *cmdutil.Factory) *cobra.Command {
$ axiom completion zsh > "${fpath[1]}/_axiom"
`),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
if completionNoDesc {
return cmd.Root().GenZshCompletionNoDesc(f.IO.Out())
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/config/config_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func newExportCommand(f *cmdutil.Factory) *cobra.Command {
$ eval $(axiom config export --force)
`),

RunE: func(_ *cobra.Command, args []string) error {
RunE: func(*cobra.Command, []string) error {
// check that the force flag was used
if !opts.Force {
fmt.Fprintf(opts.IO.ErrOut(), "%s %s\n", opts.IO.ColorScheme().ErrorIcon(), forceMessage)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/dataset/dataset_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func newListCmd(f *cmdutil.Factory) *cobra.Command {

PreRunE: cmdutil.NeedsDatasets(f),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return runList(cmd.Context(), opts)
},
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func runList(ctx context.Context, opts *listOptions) error {

var header iofmt.HeaderBuilderFunc
if opts.IO.IsStdoutTTY() {
header = func(w io.Writer, trb iofmt.TableRowBuilder) {
header = func(_ io.Writer, trb iofmt.TableRowBuilder) {
fmt.Fprintf(opts.IO.Out(), "Showing %s:\n\n", utils.Pluralize(cs, "dataset", len(datasets)))
trb.AddField("Name", cs.Bold)
trb.AddField("Description", cs.Bold)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
cmdutil.NeedsDatasets(f),
),

RunE: func(cmd *cobra.Command, args []string) (err error) {
RunE: func(cmd *cobra.Command, _ []string) (err error) {
// When no files are specified, stdin is the file to use.
if len(opts.Filenames) == 0 {
opts.Filenames = []string{"-"}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
cmdutil.NeedsDatasets(f),
),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
if err := complete(opts); err != nil {
return err
}
Expand Down Expand Up @@ -236,7 +236,7 @@ func run(ctx context.Context, opts *options) error {
columnNames = res.GroupBy
)
if opts.IO.IsStdoutTTY() {
header = func(w io.Writer, trb iofmt.TableRowBuilder) {
header = func(_ io.Writer, trb iofmt.TableRowBuilder) {
fmt.Fprint(opts.IO.Out(), headerText)
for _, name := range columnNames {
trb.AddField(name, cs.Bold)
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
`),
},

PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
PersistentPreRunE: func(cmd *cobra.Command, _ []string) (err error) {
if fl := cmd.Flag("config"); fl.Changed {
if f.Config, err = config.Load(fl.Value.String()); err != nil {
return err
Expand Down Expand Up @@ -95,7 +95,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {

PreRunE: cmdutil.AsksForSetup(f, authCmd.NewLoginCmd(f)),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return cmd.Help()
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
cmdutil.NeedsDatasets(f),
),

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
if err := complete(cmd.Context(), opts); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmdutil/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// It applies cobra.MaximumNArgs() with n being the amount of values to
// populate.
func PopulateFromArgs(f *Factory, ss ...*string) cobra.PositionalArgs {
populate := func(cmd *cobra.Command, args []string) error {
populate := func(_ *cobra.Command, args []string) error {
if !f.IO.IsStdinTTY() && len(args) < len(ss) {
return ErrNoPromptArgRequired
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmdutil/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func NeedsActiveDeployment(f *Factory) RunFunc {
// NeedsDeployments prints an error message and errors silently if no
// deployments are configured.
func NeedsDeployments(f *Factory) RunFunc {
return func(cmd *cobra.Command, _ []string) error {
return func(_ *cobra.Command, _ []string) error {
if len(f.Config.Deployments) == 0 {
return execTemplateSilent(f.IO, noDeploymentsMsgTmpl, nil)
}
Expand All @@ -169,7 +169,7 @@ func NeedsDeployments(f *Factory) RunFunc {
// NeedsValidDeployment prints an error message and errors silently if the given
// deployment is not configured. An empty alias is not evaluated.
func NeedsValidDeployment(f *Factory, alias *string) RunFunc {
return func(cmd *cobra.Command, _ []string) error {
return func(_ *cobra.Command, _ []string) error {
if _, ok := f.Config.Deployments[*alias]; !ok && *alias != "" {
return execTemplateSilent(f.IO, badDeploymentMsgTmpl, map[string]string{
"Deployment": *alias,
Expand Down

0 comments on commit 2f2550f

Please sign in to comment.