From 838c36a0f6f89d07bae0e1e71d3f3abd6d1b0e67 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Sep 2025 19:28:08 +0000 Subject: [PATCH] Remove implicit support for helm lint current directory Signed-off-by: Terry Howe --- pkg/cmd/lint.go | 7 +++---- pkg/cmd/lint_test.go | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/lint.go b/pkg/cmd/lint.go index 71540f1be..ccc53ddd0 100644 --- a/pkg/cmd/lint.go +++ b/pkg/cmd/lint.go @@ -30,6 +30,7 @@ import ( "helm.sh/helm/v4/pkg/chart/common" "helm.sh/helm/v4/pkg/chart/v2/lint/support" "helm.sh/helm/v4/pkg/cli/values" + "helm.sh/helm/v4/pkg/cmd/require" "helm.sh/helm/v4/pkg/getter" ) @@ -51,11 +52,9 @@ func newLintCmd(out io.Writer) *cobra.Command { Use: "lint PATH", Short: "examine a chart for possible issues", Long: longLintHelp, + Args: require.MinimumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { - paths := []string{"."} - if len(args) > 0 { - paths = args - } + paths := args if kubeVersion != "" { parsedKubeVersion, err := common.ParseKubeVersion(kubeVersion) diff --git a/pkg/cmd/lint_test.go b/pkg/cmd/lint_test.go index 401c84d74..270273116 100644 --- a/pkg/cmd/lint_test.go +++ b/pkg/cmd/lint_test.go @@ -91,6 +91,15 @@ func TestLintCmdWithKubeVersionFlag(t *testing.T) { runTestCmd(t, tests) } +func TestLintCmdRequiresArgs(t *testing.T) { + tests := []cmdTestCase{{ + name: "lint without arguments should fail", + cmd: "lint", + wantError: true, + }} + runTestCmd(t, tests) +} + func TestLintFileCompletion(t *testing.T) { checkFileCompletion(t, "lint", true) checkFileCompletion(t, "lint mypath", true) // Multiple paths can be given