From c6bffe21a817c96ec0e1a16e17d3e6cae555a18a Mon Sep 17 00:00:00 2001 From: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> Date: Thu, 16 May 2024 04:45:02 +0530 Subject: [PATCH] Fix linter issues Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com> --- .golangci.yml | 8 ++++++-- pkg/cmd/template.go | 2 +- pkg/yttlibrary/assert.go | 2 +- pkg/yttlibrary/math.go | 4 ++-- test/e2e/e2e_test.go | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ab57b3e0..c9f4d97b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,7 +2,6 @@ linters: enable: - goheader - revive - - deadcode - unused disable-all: true # all available settings of specific linters @@ -12,11 +11,16 @@ linters-settings: regexp: copyright-year: 20[0-9][0-9] template-path: code-header-template.txt + revive: + enable-all: true + rules: + - name: dot-imports + disabled: true issues: max-issues-per-linter: 0 max-same-issues: 0 exclude-use-default: false new-from-rev: bd77aced0a1cd6d6f3ecd3ed04c1832e1c513ab0 run: - skip-dirs: + exclude-dirs: - pkg/yamlmeta/internal diff --git a/pkg/cmd/template.go b/pkg/cmd/template.go index 7c0c65e4..3baff383 100644 --- a/pkg/cmd/template.go +++ b/pkg/cmd/template.go @@ -19,7 +19,7 @@ func NewCmd(o *template.Options) *cobra.Command { Use: "template", Aliases: []string{"t", "tpl"}, Short: "Process YAML templates (deprecated; use top-level command -- e.g. `ytt -f-` instead of `ytt template -f-`)", - RunE: func(c *cobra.Command, args []string) error { return o.Run() }, + RunE: func(_ *cobra.Command, _ []string) error { return o.Run() }, } o.BindFlags(cmd.Flags()) return cmd diff --git a/pkg/yttlibrary/assert.go b/pkg/yttlibrary/assert.go index 27a12712..78b1b07e 100644 --- a/pkg/yttlibrary/assert.go +++ b/pkg/yttlibrary/assert.go @@ -316,7 +316,7 @@ func (m AssertModule) OneNotNull(_ *starlark.Thread, _ *starlark.Builtin, args s } func (m AssertModule) oneNotNullCheck(keys starlark.Sequence) core.StarlarkFunc { - return func(thread *starlark.Thread, f *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + return func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, _ []starlark.Tuple) (starlark.Value, error) { if args.Len() != 1 { return starlark.None, fmt.Errorf("check: got %d arguments, want %d", args.Len(), 1) } diff --git a/pkg/yttlibrary/math.go b/pkg/yttlibrary/math.go index f74549ca..8becea32 100644 --- a/pkg/yttlibrary/math.go +++ b/pkg/yttlibrary/math.go @@ -156,7 +156,7 @@ func (m MathModule) AsModule() starlark.StringDict { // newUnaryBuiltin wraps a unary floating-point Go function // as a Starlark built-in that accepts int or float arguments. func (m MathModule) newUnaryBuiltin(name string, fn func(float64) float64) *starlark.Builtin { - return starlark.NewBuiltin(name, m.warnOnCall(core.ErrWrapper(func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + return starlark.NewBuiltin(name, m.warnOnCall(core.ErrWrapper(func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, _ []starlark.Tuple) (starlark.Value, error) { if args.Len() != 1 { return starlark.None, fmt.Errorf("expected exactly one argument") } @@ -173,7 +173,7 @@ func (m MathModule) newUnaryBuiltin(name string, fn func(float64) float64) *star // newBinaryBuiltin wraps a binary floating-point Go function // as a Starlark built-in that accepts int or float arguments. func (m MathModule) newBinaryBuiltin(name string, fn func(float64, float64) float64) *starlark.Builtin { - return starlark.NewBuiltin(name, m.warnOnCall(core.ErrWrapper(func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + return starlark.NewBuiltin(name, m.warnOnCall(core.ErrWrapper(func(_ *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, _ []starlark.Tuple) (starlark.Value, error) { if args.Len() != 2 { return starlark.None, fmt.Errorf("expected exactly two arguments") } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index a950ab2e..cc1f32ed 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -317,7 +317,7 @@ func TestJsonOutput(t *testing.T) { func TestPlaygroundExamplesExecuteWithoutError(t *testing.T) { t.Run("Basics", func(t *testing.T) { - filepath.WalkDir("../../examples/playground/basics", func(path string, d fs.DirEntry, err error) error { + filepath.WalkDir("../../examples/playground/basics", func(path string, d fs.DirEntry, _ error) error { if !d.IsDir() { return filepath.SkipDir } @@ -336,7 +336,7 @@ func TestPlaygroundExamplesExecuteWithoutError(t *testing.T) { }) }) t.Run("Overlays", func(t *testing.T) { - filepath.WalkDir("../../examples/playground/overlays", func(path string, d fs.DirEntry, err error) error { + filepath.WalkDir("../../examples/playground/overlays", func(path string, d fs.DirEntry, _ error) error { if !d.IsDir() { return filepath.SkipDir }