Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen Rewar <[email protected]>
  • Loading branch information
praveenrewar committed May 15, 2024
1 parent 4287858 commit c6bffe2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ linters:
enable:
- goheader
- revive
- deadcode
- unused
disable-all: true
# all available settings of specific linters
Expand All @@ -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
2 changes: 1 addition & 1 deletion pkg/cmd/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/yttlibrary/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/yttlibrary/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit c6bffe2

Please sign in to comment.